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, jbyteArray 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);
487 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
488 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
490 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
493 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
494 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
495 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
498 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
499 ret->datalen = (*env)->GetArrayLength(env, elems);
500 if (ret->datalen == 0) {
503 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
504 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
505 for (size_t i = 0; i < ret->datalen; i++) {
506 jlong arr_elem = java_elems[i];
507 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
508 FREE((void*)arr_elem);
509 ret->data[i] = arr_elem_conv;
511 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
516 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
517 LDKThirtyTwoBytes a_ref;
518 CHECK((*_env)->GetArrayLength (_env, a) == 32);
519 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
521 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
527 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
532 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
533 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
534 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
537 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
539 CHECK((*_env)->GetArrayLength (_env, a) == 64);
540 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
542 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
548 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
551 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
552 CHECK(val->result_ok);
553 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
554 *ret = (*val->contents.result);
557 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
558 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
559 CHECK(!val->result_ok);
560 return *val->contents.err;
562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
563 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
565 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
566 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
567 CHECK(val->result_ok);
568 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
569 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, (*val->contents.result).compact_form);
572 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
573 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
574 CHECK(!val->result_ok);
575 return *val->contents.err;
577 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
578 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
581 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
582 CHECK(val->result_ok);
583 LDKCVecTempl_Signature* ret = MALLOC(sizeof(LDKCVecTempl_Signature), "LDKCVecTempl_Signature");
584 *ret = (*val->contents.result);
587 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
588 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
589 CHECK(!val->result_ok);
590 return *val->contents.err;
592 static jclass LDKAPIError_APIMisuseError_class = NULL;
593 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
594 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
595 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
596 static jclass LDKAPIError_RouteError_class = NULL;
597 static jmethodID LDKAPIError_RouteError_meth = NULL;
598 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
599 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
600 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
601 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
603 LDKAPIError_APIMisuseError_class =
604 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
605 CHECK(LDKAPIError_APIMisuseError_class != NULL);
606 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
607 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
608 LDKAPIError_FeeRateTooHigh_class =
609 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
610 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
611 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
612 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
613 LDKAPIError_RouteError_class =
614 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
615 CHECK(LDKAPIError_RouteError_class != NULL);
616 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
617 CHECK(LDKAPIError_RouteError_meth != NULL);
618 LDKAPIError_ChannelUnavailable_class =
619 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
620 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
621 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
622 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
623 LDKAPIError_MonitorUpdateFailed_class =
624 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
625 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
626 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
627 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
629 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
630 LDKAPIError *obj = (LDKAPIError*)ptr;
632 case LDKAPIError_APIMisuseError: {
633 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
634 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
635 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
636 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
638 case LDKAPIError_FeeRateTooHigh: {
639 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
640 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
641 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
642 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
644 case LDKAPIError_RouteError: {
645 long err_ref = (long)&obj->route_error.err;
646 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
648 case LDKAPIError_ChannelUnavailable: {
649 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
650 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
651 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
652 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
654 case LDKAPIError_MonitorUpdateFailed: {
655 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
660 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
661 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
663 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
664 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
665 CHECK(val->result_ok);
666 return *val->contents.result;
668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
669 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
670 CHECK(!val->result_ok);
671 LDKAPIError* ret = MALLOC(sizeof(LDKAPIError), "LDKAPIError");
672 *ret = (*val->contents.err);
675 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
676 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
678 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
679 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
680 CHECK(val->result_ok);
681 return *val->contents.result;
683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
684 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
685 CHECK(!val->result_ok);
686 LDKPaymentSendFailure ret = (*val->contents.err);
687 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
689 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) {
690 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
691 LDKChannelAnnouncement a_conv;
692 a_conv.inner = (void*)(a & (~1));
693 a_conv.is_owned = (a & 1) || (a == 0);
694 if (a_conv.inner != NULL)
695 a_conv = ChannelAnnouncement_clone(&a_conv);
697 LDKChannelUpdate b_conv;
698 b_conv.inner = (void*)(b & (~1));
699 b_conv.is_owned = (b & 1) || (b == 0);
700 if (b_conv.inner != NULL)
701 b_conv = ChannelUpdate_clone(&b_conv);
703 LDKChannelUpdate c_conv;
704 c_conv.inner = (void*)(c & (~1));
705 c_conv.is_owned = (c & 1) || (c == 0);
706 if (c_conv.inner != NULL)
707 c_conv = ChannelUpdate_clone(&c_conv);
711 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
712 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
714 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
715 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
716 CHECK(val->result_ok);
717 return *val->contents.result;
719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
720 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
721 CHECK(!val->result_ok);
722 LDKPeerHandleError ret = (*val->contents.err);
723 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
725 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
726 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
727 LDKHTLCOutputInCommitment a_conv;
728 a_conv.inner = (void*)(a & (~1));
729 a_conv.is_owned = (a & 1) || (a == 0);
730 if (a_conv.inner != NULL)
731 a_conv = HTLCOutputInCommitment_clone(&a_conv);
734 CHECK((*_env)->GetArrayLength (_env, b) == 64);
735 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
739 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
740 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
741 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
742 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
743 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
744 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
746 LDKSpendableOutputDescriptor_StaticOutput_class =
747 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
748 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
749 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
750 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
751 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
752 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
753 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
754 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
755 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
756 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
757 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
758 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
759 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
760 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
762 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
763 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
765 case LDKSpendableOutputDescriptor_StaticOutput: {
766 LDKOutPoint outpoint_var = obj->static_output.outpoint;
767 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
768 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
770 if (outpoint_var.is_owned) {
771 outpoint_ref = (long)outpoint_var.inner | 1;
773 outpoint_ref = (long)&outpoint_var;
775 long output_ref = (long)&obj->static_output.output;
776 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
778 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
779 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
780 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
781 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
783 if (outpoint_var.is_owned) {
784 outpoint_ref = (long)outpoint_var.inner | 1;
786 outpoint_ref = (long)&outpoint_var;
788 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
789 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
790 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
791 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
792 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
793 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
794 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);
796 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
797 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
798 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
799 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
801 if (outpoint_var.is_owned) {
802 outpoint_ref = (long)outpoint_var.inner | 1;
804 outpoint_ref = (long)&outpoint_var;
806 long output_ref = (long)&obj->static_output_counterparty_payment.output;
807 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
808 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
813 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
814 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
815 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
818 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
819 ret->datalen = (*env)->GetArrayLength(env, elems);
820 if (ret->datalen == 0) {
823 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
824 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
825 for (size_t i = 0; i < ret->datalen; i++) {
826 jlong arr_elem = java_elems[i];
827 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
828 FREE((void*)arr_elem);
829 ret->data[i] = arr_elem_conv;
831 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
835 static jclass LDKEvent_FundingGenerationReady_class = NULL;
836 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
837 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
838 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
839 static jclass LDKEvent_PaymentReceived_class = NULL;
840 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
841 static jclass LDKEvent_PaymentSent_class = NULL;
842 static jmethodID LDKEvent_PaymentSent_meth = NULL;
843 static jclass LDKEvent_PaymentFailed_class = NULL;
844 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
845 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
846 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
847 static jclass LDKEvent_SpendableOutputs_class = NULL;
848 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
850 LDKEvent_FundingGenerationReady_class =
851 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
852 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
853 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
854 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
855 LDKEvent_FundingBroadcastSafe_class =
856 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
857 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
858 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
859 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
860 LDKEvent_PaymentReceived_class =
861 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
862 CHECK(LDKEvent_PaymentReceived_class != NULL);
863 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
864 CHECK(LDKEvent_PaymentReceived_meth != NULL);
865 LDKEvent_PaymentSent_class =
866 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
867 CHECK(LDKEvent_PaymentSent_class != NULL);
868 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
869 CHECK(LDKEvent_PaymentSent_meth != NULL);
870 LDKEvent_PaymentFailed_class =
871 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
872 CHECK(LDKEvent_PaymentFailed_class != NULL);
873 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
874 CHECK(LDKEvent_PaymentFailed_meth != NULL);
875 LDKEvent_PendingHTLCsForwardable_class =
876 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
877 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
878 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
879 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
880 LDKEvent_SpendableOutputs_class =
881 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
882 CHECK(LDKEvent_SpendableOutputs_class != NULL);
883 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
884 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
886 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
887 LDKEvent *obj = (LDKEvent*)ptr;
889 case LDKEvent_FundingGenerationReady: {
890 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
891 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
892 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
893 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
894 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
895 return (*_env)->NewObject(_env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
897 case LDKEvent_FundingBroadcastSafe: {
898 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
899 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
900 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
901 long funding_txo_ref;
902 if (funding_txo_var.is_owned) {
903 funding_txo_ref = (long)funding_txo_var.inner | 1;
905 funding_txo_ref = (long)&funding_txo_var;
907 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
909 case LDKEvent_PaymentReceived: {
910 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
911 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
912 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
913 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
914 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
916 case LDKEvent_PaymentSent: {
917 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
918 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
919 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
921 case LDKEvent_PaymentFailed: {
922 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
923 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
924 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
926 case LDKEvent_PendingHTLCsForwardable: {
927 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
929 case LDKEvent_SpendableOutputs: {
930 long outputs_ref = (long)&obj->spendable_outputs.outputs;
931 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
936 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
937 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
938 static jclass LDKErrorAction_IgnoreError_class = NULL;
939 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
940 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
941 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
942 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
943 LDKErrorAction_DisconnectPeer_class =
944 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
945 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
946 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
947 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
948 LDKErrorAction_IgnoreError_class =
949 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
950 CHECK(LDKErrorAction_IgnoreError_class != NULL);
951 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
952 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
953 LDKErrorAction_SendErrorMessage_class =
954 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
955 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
956 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
957 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
959 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
960 LDKErrorAction *obj = (LDKErrorAction*)ptr;
962 case LDKErrorAction_DisconnectPeer: {
963 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
964 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
965 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
967 if (msg_var.is_owned) {
968 msg_ref = (long)msg_var.inner | 1;
970 msg_ref = (long)&msg_var;
972 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
974 case LDKErrorAction_IgnoreError: {
975 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
977 case LDKErrorAction_SendErrorMessage: {
978 LDKErrorMessage msg_var = obj->send_error_message.msg;
979 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
980 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
982 if (msg_var.is_owned) {
983 msg_ref = (long)msg_var.inner | 1;
985 msg_ref = (long)&msg_var;
987 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
992 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
993 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
994 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
995 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
996 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
997 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
999 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1000 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1001 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1002 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1003 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1004 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1005 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1006 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1007 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1008 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1009 LDKHTLCFailChannelUpdate_NodeFailure_class =
1010 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1011 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1012 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1013 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1015 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1016 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1018 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1019 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1020 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1021 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1023 if (msg_var.is_owned) {
1024 msg_ref = (long)msg_var.inner | 1;
1026 msg_ref = (long)&msg_var;
1028 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1030 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1031 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1033 case LDKHTLCFailChannelUpdate_NodeFailure: {
1034 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1035 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1036 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1041 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1042 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1043 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1044 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1045 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1046 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1047 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1048 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1049 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1050 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1051 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1052 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1053 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1054 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1055 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1056 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1057 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1058 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1059 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1060 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1061 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1062 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1063 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1064 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1065 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1066 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1067 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1068 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1069 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1070 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1071 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1072 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1074 LDKMessageSendEvent_SendAcceptChannel_class =
1075 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1076 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1077 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1078 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1079 LDKMessageSendEvent_SendOpenChannel_class =
1080 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1081 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1082 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1083 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1084 LDKMessageSendEvent_SendFundingCreated_class =
1085 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1086 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1087 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1088 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1089 LDKMessageSendEvent_SendFundingSigned_class =
1090 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1091 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1092 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1093 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1094 LDKMessageSendEvent_SendFundingLocked_class =
1095 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1096 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1097 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1098 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1099 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1100 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1101 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1102 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1103 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1104 LDKMessageSendEvent_UpdateHTLCs_class =
1105 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1106 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1107 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1108 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1109 LDKMessageSendEvent_SendRevokeAndACK_class =
1110 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1111 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1112 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1113 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1114 LDKMessageSendEvent_SendClosingSigned_class =
1115 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1116 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1117 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1118 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1119 LDKMessageSendEvent_SendShutdown_class =
1120 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1121 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1122 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1123 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1124 LDKMessageSendEvent_SendChannelReestablish_class =
1125 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1126 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1127 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1128 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1129 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1130 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1131 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1132 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1133 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1134 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1135 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1136 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1137 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1138 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1139 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1140 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1141 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1142 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1143 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1144 LDKMessageSendEvent_HandleError_class =
1145 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1146 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1147 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1148 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1149 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1150 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1151 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1152 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1153 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1155 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1156 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1158 case LDKMessageSendEvent_SendAcceptChannel: {
1159 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1160 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1161 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1162 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1163 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1165 if (msg_var.is_owned) {
1166 msg_ref = (long)msg_var.inner | 1;
1168 msg_ref = (long)&msg_var;
1170 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1172 case LDKMessageSendEvent_SendOpenChannel: {
1173 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1174 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1175 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1176 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1177 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1179 if (msg_var.is_owned) {
1180 msg_ref = (long)msg_var.inner | 1;
1182 msg_ref = (long)&msg_var;
1184 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1186 case LDKMessageSendEvent_SendFundingCreated: {
1187 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1188 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1189 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1190 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1191 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1193 if (msg_var.is_owned) {
1194 msg_ref = (long)msg_var.inner | 1;
1196 msg_ref = (long)&msg_var;
1198 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1200 case LDKMessageSendEvent_SendFundingSigned: {
1201 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1202 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1203 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1204 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1205 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1207 if (msg_var.is_owned) {
1208 msg_ref = (long)msg_var.inner | 1;
1210 msg_ref = (long)&msg_var;
1212 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1214 case LDKMessageSendEvent_SendFundingLocked: {
1215 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1216 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1217 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1218 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1219 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1221 if (msg_var.is_owned) {
1222 msg_ref = (long)msg_var.inner | 1;
1224 msg_ref = (long)&msg_var;
1226 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1228 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1229 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1230 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1231 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1232 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1233 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1235 if (msg_var.is_owned) {
1236 msg_ref = (long)msg_var.inner | 1;
1238 msg_ref = (long)&msg_var;
1240 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1242 case LDKMessageSendEvent_UpdateHTLCs: {
1243 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1244 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1245 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1246 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1247 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1249 if (updates_var.is_owned) {
1250 updates_ref = (long)updates_var.inner | 1;
1252 updates_ref = (long)&updates_var;
1254 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1256 case LDKMessageSendEvent_SendRevokeAndACK: {
1257 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1258 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1259 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1260 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1261 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1263 if (msg_var.is_owned) {
1264 msg_ref = (long)msg_var.inner | 1;
1266 msg_ref = (long)&msg_var;
1268 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1270 case LDKMessageSendEvent_SendClosingSigned: {
1271 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1272 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1273 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1274 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1275 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1277 if (msg_var.is_owned) {
1278 msg_ref = (long)msg_var.inner | 1;
1280 msg_ref = (long)&msg_var;
1282 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1284 case LDKMessageSendEvent_SendShutdown: {
1285 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1286 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1287 LDKShutdown msg_var = obj->send_shutdown.msg;
1288 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1289 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1291 if (msg_var.is_owned) {
1292 msg_ref = (long)msg_var.inner | 1;
1294 msg_ref = (long)&msg_var;
1296 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1298 case LDKMessageSendEvent_SendChannelReestablish: {
1299 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1300 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1301 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1302 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1303 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1305 if (msg_var.is_owned) {
1306 msg_ref = (long)msg_var.inner | 1;
1308 msg_ref = (long)&msg_var;
1310 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1312 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1313 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1314 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1315 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1317 if (msg_var.is_owned) {
1318 msg_ref = (long)msg_var.inner | 1;
1320 msg_ref = (long)&msg_var;
1322 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1323 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1324 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 long update_msg_ref;
1326 if (update_msg_var.is_owned) {
1327 update_msg_ref = (long)update_msg_var.inner | 1;
1329 update_msg_ref = (long)&update_msg_var;
1331 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1333 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1334 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1335 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1336 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1338 if (msg_var.is_owned) {
1339 msg_ref = (long)msg_var.inner | 1;
1341 msg_ref = (long)&msg_var;
1343 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1345 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1346 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1347 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1348 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1350 if (msg_var.is_owned) {
1351 msg_ref = (long)msg_var.inner | 1;
1353 msg_ref = (long)&msg_var;
1355 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1357 case LDKMessageSendEvent_HandleError: {
1358 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1359 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1360 long action_ref = (long)&obj->handle_error.action;
1361 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1363 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1364 long update_ref = (long)&obj->payment_failure_network_update.update;
1365 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1370 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1371 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1372 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1374 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1375 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1376 ret->datalen = (*env)->GetArrayLength(env, elems);
1377 if (ret->datalen == 0) {
1380 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1381 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1382 for (size_t i = 0; i < ret->datalen; i++) {
1383 jlong arr_elem = java_elems[i];
1384 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1385 FREE((void*)arr_elem);
1386 ret->data[i] = arr_elem_conv;
1388 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1392 typedef struct LDKMessageSendEventsProvider_JCalls {
1393 atomic_size_t refcnt;
1396 jmethodID get_and_clear_pending_msg_events_meth;
1397 } LDKMessageSendEventsProvider_JCalls;
1398 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1399 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1401 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1402 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1404 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1405 LDKCVec_MessageSendEventZ res = *ret;
1409 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1410 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1411 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1413 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1414 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1418 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1419 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1420 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1421 return (void*) this_arg;
1423 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1424 jclass c = (*env)->GetObjectClass(env, o);
1426 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1427 atomic_init(&calls->refcnt, 1);
1428 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1429 calls->o = (*env)->NewWeakGlobalRef(env, o);
1430 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1431 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1433 LDKMessageSendEventsProvider ret = {
1434 .this_arg = (void*) calls,
1435 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1436 .free = LDKMessageSendEventsProvider_JCalls_free,
1440 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1441 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1442 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1443 return (long)res_ptr;
1445 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1446 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1451 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1452 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1453 *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1457 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1458 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1459 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1461 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1462 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1463 ret->datalen = (*env)->GetArrayLength(env, elems);
1464 if (ret->datalen == 0) {
1467 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1468 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1469 for (size_t i = 0; i < ret->datalen; i++) {
1470 jlong arr_elem = java_elems[i];
1471 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1472 FREE((void*)arr_elem);
1473 ret->data[i] = arr_elem_conv;
1475 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1479 typedef struct LDKEventsProvider_JCalls {
1480 atomic_size_t refcnt;
1483 jmethodID get_and_clear_pending_events_meth;
1484 } LDKEventsProvider_JCalls;
1485 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1486 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1488 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1489 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1491 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1492 LDKCVec_EventZ res = *ret;
1496 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1497 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1498 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1500 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1501 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1505 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1506 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1507 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1508 return (void*) this_arg;
1510 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1511 jclass c = (*env)->GetObjectClass(env, o);
1513 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1514 atomic_init(&calls->refcnt, 1);
1515 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1516 calls->o = (*env)->NewWeakGlobalRef(env, o);
1517 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1518 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1520 LDKEventsProvider ret = {
1521 .this_arg = (void*) calls,
1522 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1523 .free = LDKEventsProvider_JCalls_free,
1527 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1528 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1529 *res_ptr = LDKEventsProvider_init(env, _a, o);
1530 return (long)res_ptr;
1532 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1533 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1537 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1538 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1539 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1540 *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1544 typedef struct LDKLogger_JCalls {
1545 atomic_size_t refcnt;
1550 void log_jcall(const void* this_arg, const char *record) {
1551 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1553 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1554 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1555 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1557 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1559 static void LDKLogger_JCalls_free(void* this_arg) {
1560 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1561 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1563 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1564 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1568 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1569 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1570 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1571 return (void*) this_arg;
1573 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1574 jclass c = (*env)->GetObjectClass(env, o);
1576 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1577 atomic_init(&calls->refcnt, 1);
1578 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1579 calls->o = (*env)->NewWeakGlobalRef(env, o);
1580 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1581 CHECK(calls->log_meth != NULL);
1584 .this_arg = (void*) calls,
1586 .free = LDKLogger_JCalls_free,
1590 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1591 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1592 *res_ptr = LDKLogger_init(env, _a, o);
1593 return (long)res_ptr;
1595 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1596 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1600 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1601 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1603 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1604 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1605 CHECK(val->result_ok);
1606 LDKTxOut* ret = MALLOC(sizeof(LDKTxOut), "LDKTxOut");
1607 *ret = (*val->contents.result);
1610 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1611 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1612 CHECK(!val->result_ok);
1613 jclass ret = LDKAccessError_to_java(_env, (*val->contents.err));
1616 typedef struct LDKAccess_JCalls {
1617 atomic_size_t refcnt;
1620 jmethodID get_utxo_meth;
1622 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1623 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1625 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1626 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1627 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1628 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1630 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1631 LDKCResult_TxOutAccessErrorZ res = *ret;
1635 static void LDKAccess_JCalls_free(void* this_arg) {
1636 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1637 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1639 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1640 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1644 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1645 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1646 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1647 return (void*) this_arg;
1649 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1650 jclass c = (*env)->GetObjectClass(env, o);
1652 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1653 atomic_init(&calls->refcnt, 1);
1654 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1655 calls->o = (*env)->NewWeakGlobalRef(env, o);
1656 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1657 CHECK(calls->get_utxo_meth != NULL);
1660 .this_arg = (void*) calls,
1661 .get_utxo = get_utxo_jcall,
1662 .free = LDKAccess_JCalls_free,
1666 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1667 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1668 *res_ptr = LDKAccess_init(env, _a, o);
1669 return (long)res_ptr;
1671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1672 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1676 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) {
1677 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1678 unsigned char genesis_hash_arr[32];
1679 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1680 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1681 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1682 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1683 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1687 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1688 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1689 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1690 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1691 for (size_t i = 0; i < vec->datalen; i++) {
1692 CHECK((((long)vec->data[i].inner) & 1) == 0);
1693 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1695 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1698 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1699 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1700 ret->datalen = (*env)->GetArrayLength(env, elems);
1701 if (ret->datalen == 0) {
1704 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1705 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1706 for (size_t i = 0; i < ret->datalen; i++) {
1707 jlong arr_elem = java_elems[i];
1708 LDKHTLCOutputInCommitment arr_elem_conv;
1709 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1710 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1711 if (arr_elem_conv.inner != NULL)
1712 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1713 ret->data[i] = arr_elem_conv;
1715 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1719 typedef struct LDKChannelKeys_JCalls {
1720 atomic_size_t refcnt;
1723 jmethodID get_per_commitment_point_meth;
1724 jmethodID release_commitment_secret_meth;
1725 jmethodID key_derivation_params_meth;
1726 jmethodID sign_counterparty_commitment_meth;
1727 jmethodID sign_holder_commitment_meth;
1728 jmethodID sign_holder_commitment_htlc_transactions_meth;
1729 jmethodID sign_justice_transaction_meth;
1730 jmethodID sign_counterparty_htlc_transaction_meth;
1731 jmethodID sign_closing_transaction_meth;
1732 jmethodID sign_channel_announcement_meth;
1733 jmethodID on_accept_meth;
1734 } LDKChannelKeys_JCalls;
1735 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1736 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1738 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1739 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1741 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1742 LDKPublicKey ret_ref;
1743 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
1744 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
1747 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1748 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1750 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1751 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1753 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1754 LDKThirtyTwoBytes ret_ref;
1755 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
1756 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
1759 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1760 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1762 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1763 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1765 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1766 LDKC2Tuple_u64u64Z res = *ret;
1770 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) {
1771 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1773 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1774 long commitment_tx_ref = (long)&commitment_tx;
1775 long htlcs_ref = (long)&htlcs;
1776 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1778 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);
1779 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1783 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1784 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1786 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1787 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1789 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1790 LDKCResult_SignatureNoneZ res = *ret;
1794 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1795 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1797 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1798 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1800 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1801 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1805 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) {
1806 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1808 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1809 long justice_tx_ref = (long)&justice_tx;
1810 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1811 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1812 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1814 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);
1815 LDKCResult_SignatureNoneZ res = *ret;
1819 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) {
1820 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1822 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1823 long htlc_tx_ref = (long)&htlc_tx;
1824 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1825 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1826 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1828 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);
1829 LDKCResult_SignatureNoneZ res = *ret;
1833 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1834 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1836 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1837 long closing_tx_ref = (long)&closing_tx;
1838 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1840 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1841 LDKCResult_SignatureNoneZ res = *ret;
1845 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1846 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1848 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1849 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1851 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg);
1852 LDKCResult_SignatureNoneZ res = *ret;
1856 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1857 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1859 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1862 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1864 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1865 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1866 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1868 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1869 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1873 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1874 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1875 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1876 return (void*) this_arg;
1878 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1879 jclass c = (*env)->GetObjectClass(env, o);
1881 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1882 atomic_init(&calls->refcnt, 1);
1883 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1884 calls->o = (*env)->NewWeakGlobalRef(env, o);
1885 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1886 CHECK(calls->get_per_commitment_point_meth != NULL);
1887 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1888 CHECK(calls->release_commitment_secret_meth != NULL);
1889 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1890 CHECK(calls->key_derivation_params_meth != NULL);
1891 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1892 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1893 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1894 CHECK(calls->sign_holder_commitment_meth != NULL);
1895 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1896 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1897 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1898 CHECK(calls->sign_justice_transaction_meth != NULL);
1899 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1900 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1901 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1902 CHECK(calls->sign_closing_transaction_meth != NULL);
1903 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1904 CHECK(calls->sign_channel_announcement_meth != NULL);
1905 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1906 CHECK(calls->on_accept_meth != NULL);
1908 LDKChannelKeys ret = {
1909 .this_arg = (void*) calls,
1910 .get_per_commitment_point = get_per_commitment_point_jcall,
1911 .release_commitment_secret = release_commitment_secret_jcall,
1912 .key_derivation_params = key_derivation_params_jcall,
1913 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1914 .sign_holder_commitment = sign_holder_commitment_jcall,
1915 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1916 .sign_justice_transaction = sign_justice_transaction_jcall,
1917 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1918 .sign_closing_transaction = sign_closing_transaction_jcall,
1919 .sign_channel_announcement = sign_channel_announcement_jcall,
1920 .on_accept = on_accept_jcall,
1921 .clone = LDKChannelKeys_JCalls_clone,
1922 .free = LDKChannelKeys_JCalls_free,
1926 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1927 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1928 *res_ptr = LDKChannelKeys_init(env, _a, o);
1929 return (long)res_ptr;
1931 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1932 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1936 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1937 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1938 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1939 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1943 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1944 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1945 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1946 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1951 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1952 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1953 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1957 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) {
1958 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1959 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1960 FREE((void*)commitment_tx);
1961 LDKPreCalculatedTxCreationKeys keys_conv;
1962 keys_conv.inner = (void*)(keys & (~1));
1963 keys_conv.is_owned = (keys & 1) || (keys == 0);
1964 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1966 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1967 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(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_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1977 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1981 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) {
1982 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1983 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1984 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1985 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1986 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1987 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1991 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) {
1992 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1993 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1994 FREE((void*)justice_tx);
1995 unsigned char per_commitment_key_arr[32];
1996 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
1997 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1998 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1999 LDKHTLCOutputInCommitment htlc_conv;
2000 htlc_conv.inner = (void*)(htlc & (~1));
2001 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2002 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2003 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2007 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) {
2008 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2009 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2010 FREE((void*)htlc_tx);
2011 LDKPublicKey per_commitment_point_ref;
2012 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2013 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2014 LDKHTLCOutputInCommitment htlc_conv;
2015 htlc_conv.inner = (void*)(htlc & (~1));
2016 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2017 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2018 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2023 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2024 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2025 FREE((void*)closing_tx);
2026 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2027 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2032 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2033 LDKUnsignedChannelAnnouncement msg_conv;
2034 msg_conv.inner = (void*)(msg & (~1));
2035 msg_conv.is_owned = (msg & 1) || (msg == 0);
2036 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2037 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2041 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) {
2042 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2043 LDKChannelPublicKeys channel_points_conv;
2044 channel_points_conv.inner = (void*)(channel_points & (~1));
2045 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2046 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2049 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2050 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2051 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2052 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2053 for (size_t i = 0; i < vec->datalen; i++) {
2054 CHECK((((long)vec->data[i].inner) & 1) == 0);
2055 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2057 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2061 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2062 ret->datalen = (*env)->GetArrayLength(env, elems);
2063 if (ret->datalen == 0) {
2066 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2067 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2068 for (size_t i = 0; i < ret->datalen; i++) {
2069 jlong arr_elem = java_elems[i];
2070 LDKMonitorEvent arr_elem_conv;
2071 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2072 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2073 // Warning: we may need a move here but can't clone!
2074 ret->data[i] = arr_elem_conv;
2076 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2080 typedef struct LDKWatch_JCalls {
2081 atomic_size_t refcnt;
2084 jmethodID watch_channel_meth;
2085 jmethodID update_channel_meth;
2086 jmethodID release_pending_monitor_events_meth;
2088 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2089 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2091 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2092 LDKOutPoint funding_txo_var = funding_txo;
2093 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2094 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2095 long funding_txo_ref;
2096 if (funding_txo_var.is_owned) {
2097 funding_txo_ref = (long)funding_txo_var.inner | 1;
2099 funding_txo_ref = (long)&funding_txo_var;
2101 LDKChannelMonitor monitor_var = monitor;
2102 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2103 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2105 if (monitor_var.is_owned) {
2106 monitor_ref = (long)monitor_var.inner | 1;
2108 monitor_ref = (long)&monitor_var;
2110 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2112 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2113 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2117 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2118 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2120 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2121 LDKOutPoint funding_txo_var = funding_txo;
2122 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2123 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2124 long funding_txo_ref;
2125 if (funding_txo_var.is_owned) {
2126 funding_txo_ref = (long)funding_txo_var.inner | 1;
2128 funding_txo_ref = (long)&funding_txo_var;
2130 LDKChannelMonitorUpdate update_var = update;
2131 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2132 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2134 if (update_var.is_owned) {
2135 update_ref = (long)update_var.inner | 1;
2137 update_ref = (long)&update_var;
2139 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2141 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2142 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2146 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2147 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2149 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2150 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2152 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*_env)->CallLongMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2153 LDKCVec_MonitorEventZ res = *ret;
2157 static void LDKWatch_JCalls_free(void* this_arg) {
2158 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2159 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2161 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2162 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2166 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2167 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2168 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2169 return (void*) this_arg;
2171 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2172 jclass c = (*env)->GetObjectClass(env, o);
2174 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2175 atomic_init(&calls->refcnt, 1);
2176 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2177 calls->o = (*env)->NewWeakGlobalRef(env, o);
2178 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2179 CHECK(calls->watch_channel_meth != NULL);
2180 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2181 CHECK(calls->update_channel_meth != NULL);
2182 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2183 CHECK(calls->release_pending_monitor_events_meth != NULL);
2186 .this_arg = (void*) calls,
2187 .watch_channel = watch_channel_jcall,
2188 .update_channel = update_channel_jcall,
2189 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2190 .free = LDKWatch_JCalls_free,
2194 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2195 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2196 *res_ptr = LDKWatch_init(env, _a, o);
2197 return (long)res_ptr;
2199 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2200 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2204 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2205 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2206 LDKOutPoint funding_txo_conv;
2207 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2208 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2209 if (funding_txo_conv.inner != NULL)
2210 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2211 LDKChannelMonitor monitor_conv;
2212 monitor_conv.inner = (void*)(monitor & (~1));
2213 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2214 // Warning: we may need a move here but can't clone!
2215 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2216 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2221 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2222 LDKOutPoint funding_txo_conv;
2223 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2224 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2225 if (funding_txo_conv.inner != NULL)
2226 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2227 LDKChannelMonitorUpdate update_conv;
2228 update_conv.inner = (void*)(update & (~1));
2229 update_conv.is_owned = (update & 1) || (update == 0);
2230 if (update_conv.inner != NULL)
2231 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2232 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2233 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2238 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2239 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2240 *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2244 typedef struct LDKFilter_JCalls {
2245 atomic_size_t refcnt;
2248 jmethodID register_tx_meth;
2249 jmethodID register_output_meth;
2251 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2252 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2254 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2255 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2256 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2257 LDKu8slice script_pubkey_var = script_pubkey;
2258 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2259 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2260 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2262 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2264 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2265 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2267 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2268 LDKu8slice script_pubkey_var = script_pubkey;
2269 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2270 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2271 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2273 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2275 static void LDKFilter_JCalls_free(void* this_arg) {
2276 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2277 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2279 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2280 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2284 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2285 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2286 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2287 return (void*) this_arg;
2289 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2290 jclass c = (*env)->GetObjectClass(env, o);
2292 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2293 atomic_init(&calls->refcnt, 1);
2294 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2295 calls->o = (*env)->NewWeakGlobalRef(env, o);
2296 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2297 CHECK(calls->register_tx_meth != NULL);
2298 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2299 CHECK(calls->register_output_meth != NULL);
2302 .this_arg = (void*) calls,
2303 .register_tx = register_tx_jcall,
2304 .register_output = register_output_jcall,
2305 .free = LDKFilter_JCalls_free,
2309 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2310 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2311 *res_ptr = LDKFilter_init(env, _a, o);
2312 return (long)res_ptr;
2314 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2315 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2319 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2320 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2321 unsigned char txid_arr[32];
2322 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2323 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2324 unsigned char (*txid_ref)[32] = &txid_arr;
2325 LDKu8slice script_pubkey_ref;
2326 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2327 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2328 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2329 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2333 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2334 LDKOutPoint outpoint_conv;
2335 outpoint_conv.inner = (void*)(outpoint & (~1));
2336 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2337 LDKu8slice script_pubkey_ref;
2338 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2339 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2340 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2341 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2344 typedef struct LDKBroadcasterInterface_JCalls {
2345 atomic_size_t refcnt;
2348 jmethodID broadcast_transaction_meth;
2349 } LDKBroadcasterInterface_JCalls;
2350 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2351 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2353 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2354 long tx_ref = (long)&tx;
2355 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2357 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2359 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2360 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2361 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2364 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2368 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2369 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2370 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2371 return (void*) this_arg;
2373 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2374 jclass c = (*env)->GetObjectClass(env, o);
2376 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2377 atomic_init(&calls->refcnt, 1);
2378 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2379 calls->o = (*env)->NewWeakGlobalRef(env, o);
2380 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2381 CHECK(calls->broadcast_transaction_meth != NULL);
2383 LDKBroadcasterInterface ret = {
2384 .this_arg = (void*) calls,
2385 .broadcast_transaction = broadcast_transaction_jcall,
2386 .free = LDKBroadcasterInterface_JCalls_free,
2390 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2391 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2392 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2393 return (long)res_ptr;
2395 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2396 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2401 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2402 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2404 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2407 typedef struct LDKFeeEstimator_JCalls {
2408 atomic_size_t refcnt;
2411 jmethodID get_est_sat_per_1000_weight_meth;
2412 } LDKFeeEstimator_JCalls;
2413 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2414 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2416 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2417 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2418 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2420 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2422 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2423 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2424 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2426 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2427 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2431 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2432 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2433 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2434 return (void*) this_arg;
2436 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2437 jclass c = (*env)->GetObjectClass(env, o);
2439 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2440 atomic_init(&calls->refcnt, 1);
2441 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2442 calls->o = (*env)->NewWeakGlobalRef(env, o);
2443 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2444 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2446 LDKFeeEstimator ret = {
2447 .this_arg = (void*) calls,
2448 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2449 .free = LDKFeeEstimator_JCalls_free,
2453 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2454 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2455 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2456 return (long)res_ptr;
2458 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2459 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2463 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) {
2464 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2465 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2466 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2470 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2471 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2472 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2475 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2476 ret->datalen = (*env)->GetArrayLength(env, elems);
2477 if (ret->datalen == 0) {
2480 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2481 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2482 for (size_t i = 0; i < ret->datalen; i++) {
2483 jlong arr_elem = java_elems[i];
2484 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2485 FREE((void*)arr_elem);
2486 ret->data[i] = arr_elem_conv;
2488 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2492 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2493 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2494 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2497 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2498 ret->datalen = (*env)->GetArrayLength(env, elems);
2499 if (ret->datalen == 0) {
2502 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2503 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2504 for (size_t i = 0; i < ret->datalen; i++) {
2505 jlong arr_elem = java_elems[i];
2506 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2507 FREE((void*)arr_elem);
2508 ret->data[i] = arr_elem_conv;
2510 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2514 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2515 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2516 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2519 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2520 ret->datalen = (*env)->GetArrayLength(env, elems);
2521 if (ret->datalen == 0) {
2524 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2525 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2526 for (size_t i = 0; i < ret->datalen; i++) {
2527 jlong arr_elem = java_elems[i];
2528 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2529 FREE((void*)arr_elem);
2530 ret->data[i] = arr_elem_conv;
2532 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2536 typedef struct LDKKeysInterface_JCalls {
2537 atomic_size_t refcnt;
2540 jmethodID get_node_secret_meth;
2541 jmethodID get_destination_script_meth;
2542 jmethodID get_shutdown_pubkey_meth;
2543 jmethodID get_channel_keys_meth;
2544 jmethodID get_secure_random_bytes_meth;
2545 } LDKKeysInterface_JCalls;
2546 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2547 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2549 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2550 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2552 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2553 LDKSecretKey ret_ref;
2554 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2555 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes);
2558 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2559 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2561 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2562 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2564 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2565 LDKCVec_u8Z ret_ref;
2566 ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL);
2567 ret_ref.datalen = (*_env)->GetArrayLength (_env, ret);
2570 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2571 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2573 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2574 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2576 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2577 LDKPublicKey ret_ref;
2578 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
2579 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
2582 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
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 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2589 LDKChannelKeys res = *ret;
2593 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2594 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2597 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2599 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2600 LDKThirtyTwoBytes ret_ref;
2601 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2602 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
2605 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2606 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2607 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2609 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2610 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2614 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2615 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2616 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2617 return (void*) this_arg;
2619 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2620 jclass c = (*env)->GetObjectClass(env, o);
2622 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2623 atomic_init(&calls->refcnt, 1);
2624 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2625 calls->o = (*env)->NewWeakGlobalRef(env, o);
2626 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2627 CHECK(calls->get_node_secret_meth != NULL);
2628 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2629 CHECK(calls->get_destination_script_meth != NULL);
2630 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2631 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2632 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2633 CHECK(calls->get_channel_keys_meth != NULL);
2634 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2635 CHECK(calls->get_secure_random_bytes_meth != NULL);
2637 LDKKeysInterface ret = {
2638 .this_arg = (void*) calls,
2639 .get_node_secret = get_node_secret_jcall,
2640 .get_destination_script = get_destination_script_jcall,
2641 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2642 .get_channel_keys = get_channel_keys_jcall,
2643 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2644 .free = LDKKeysInterface_JCalls_free,
2648 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2649 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2650 *res_ptr = LDKKeysInterface_init(env, _a, o);
2651 return (long)res_ptr;
2653 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2654 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2658 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2659 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2660 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2661 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2665 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2666 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2667 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2668 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2669 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2673 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2674 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2675 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2676 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2680 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) {
2681 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2682 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2683 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2687 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2688 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2689 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2690 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2694 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2695 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2696 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2697 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2698 for (size_t i = 0; i < vec->datalen; i++) {
2699 CHECK((((long)vec->data[i].inner) & 1) == 0);
2700 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2702 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2706 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2707 ret->datalen = (*env)->GetArrayLength(env, elems);
2708 if (ret->datalen == 0) {
2711 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2712 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2713 for (size_t i = 0; i < ret->datalen; i++) {
2714 jlong arr_elem = java_elems[i];
2715 LDKChannelDetails arr_elem_conv;
2716 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2717 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2718 if (arr_elem_conv.inner != NULL)
2719 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2720 ret->data[i] = arr_elem_conv;
2722 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2726 static jclass LDKNetAddress_IPv4_class = NULL;
2727 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2728 static jclass LDKNetAddress_IPv6_class = NULL;
2729 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2730 static jclass LDKNetAddress_OnionV2_class = NULL;
2731 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2732 static jclass LDKNetAddress_OnionV3_class = NULL;
2733 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2735 LDKNetAddress_IPv4_class =
2736 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2737 CHECK(LDKNetAddress_IPv4_class != NULL);
2738 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2739 CHECK(LDKNetAddress_IPv4_meth != NULL);
2740 LDKNetAddress_IPv6_class =
2741 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2742 CHECK(LDKNetAddress_IPv6_class != NULL);
2743 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2744 CHECK(LDKNetAddress_IPv6_meth != NULL);
2745 LDKNetAddress_OnionV2_class =
2746 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2747 CHECK(LDKNetAddress_OnionV2_class != NULL);
2748 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2749 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2750 LDKNetAddress_OnionV3_class =
2751 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2752 CHECK(LDKNetAddress_OnionV3_class != NULL);
2753 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2754 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2756 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2757 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2759 case LDKNetAddress_IPv4: {
2760 long addr_ref = (long)&obj->i_pv4.addr;
2761 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2763 case LDKNetAddress_IPv6: {
2764 long addr_ref = (long)&obj->i_pv6.addr;
2765 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2767 case LDKNetAddress_OnionV2: {
2768 long addr_ref = (long)&obj->onion_v2.addr;
2769 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2771 case LDKNetAddress_OnionV3: {
2772 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2773 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2774 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);
2779 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2780 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2781 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2783 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2784 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2785 ret->datalen = (*env)->GetArrayLength(env, elems);
2786 if (ret->datalen == 0) {
2789 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2790 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2791 for (size_t i = 0; i < ret->datalen; i++) {
2792 jlong arr_elem = java_elems[i];
2793 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2794 FREE((void*)arr_elem);
2795 ret->data[i] = arr_elem_conv;
2797 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2801 typedef struct LDKChannelMessageHandler_JCalls {
2802 atomic_size_t refcnt;
2805 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2806 jmethodID handle_open_channel_meth;
2807 jmethodID handle_accept_channel_meth;
2808 jmethodID handle_funding_created_meth;
2809 jmethodID handle_funding_signed_meth;
2810 jmethodID handle_funding_locked_meth;
2811 jmethodID handle_shutdown_meth;
2812 jmethodID handle_closing_signed_meth;
2813 jmethodID handle_update_add_htlc_meth;
2814 jmethodID handle_update_fulfill_htlc_meth;
2815 jmethodID handle_update_fail_htlc_meth;
2816 jmethodID handle_update_fail_malformed_htlc_meth;
2817 jmethodID handle_commitment_signed_meth;
2818 jmethodID handle_revoke_and_ack_meth;
2819 jmethodID handle_update_fee_meth;
2820 jmethodID handle_announcement_signatures_meth;
2821 jmethodID peer_disconnected_meth;
2822 jmethodID peer_connected_meth;
2823 jmethodID handle_channel_reestablish_meth;
2824 jmethodID handle_error_meth;
2825 } LDKChannelMessageHandler_JCalls;
2826 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2827 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2829 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2830 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2831 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2832 LDKInitFeatures their_features_var = their_features;
2833 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2834 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2835 long their_features_ref;
2836 if (their_features_var.is_owned) {
2837 their_features_ref = (long)their_features_var.inner | 1;
2839 their_features_ref = (long)&their_features_var;
2841 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2843 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2845 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2846 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2848 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2849 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2850 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2851 LDKInitFeatures their_features_var = their_features;
2852 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2853 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2854 long their_features_ref;
2855 if (their_features_var.is_owned) {
2856 their_features_ref = (long)their_features_var.inner | 1;
2858 their_features_ref = (long)&their_features_var;
2860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2862 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2864 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2865 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2867 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2868 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2869 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2870 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2872 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2874 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2875 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2877 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2878 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2879 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2880 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2882 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2884 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2885 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2887 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2888 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2889 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2890 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2892 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2894 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2895 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2897 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2898 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2899 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2900 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2902 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2904 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2905 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2907 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2908 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2909 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2910 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2912 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2914 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2915 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2917 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2918 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2919 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2920 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2922 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2924 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2925 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2927 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2928 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2929 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2930 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2932 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2934 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2935 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2937 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2938 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2939 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2940 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2942 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2944 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2945 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2947 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2948 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2949 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2950 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2952 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2954 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2955 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2957 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2958 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2959 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2960 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2962 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2964 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2965 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2967 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2968 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2969 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2970 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2972 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2974 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2975 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2977 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2978 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2979 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2980 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2982 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2984 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2985 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2987 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2988 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2989 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2990 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2992 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2994 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2995 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2997 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2998 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2999 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3000 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3002 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3004 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3005 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3007 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3008 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3009 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3010 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3012 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3014 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3015 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3017 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3018 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3019 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3020 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3022 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3024 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3025 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3027 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3028 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3029 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3030 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3032 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3034 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3035 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3036 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3038 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3039 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3043 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3044 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3045 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3046 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3047 return (void*) this_arg;
3049 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3050 jclass c = (*env)->GetObjectClass(env, o);
3052 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3053 atomic_init(&calls->refcnt, 1);
3054 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3055 calls->o = (*env)->NewWeakGlobalRef(env, o);
3056 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3057 CHECK(calls->handle_open_channel_meth != NULL);
3058 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3059 CHECK(calls->handle_accept_channel_meth != NULL);
3060 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3061 CHECK(calls->handle_funding_created_meth != NULL);
3062 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3063 CHECK(calls->handle_funding_signed_meth != NULL);
3064 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3065 CHECK(calls->handle_funding_locked_meth != NULL);
3066 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3067 CHECK(calls->handle_shutdown_meth != NULL);
3068 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3069 CHECK(calls->handle_closing_signed_meth != NULL);
3070 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3071 CHECK(calls->handle_update_add_htlc_meth != NULL);
3072 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3073 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3074 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3075 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3076 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3077 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3078 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3079 CHECK(calls->handle_commitment_signed_meth != NULL);
3080 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3081 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3082 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3083 CHECK(calls->handle_update_fee_meth != NULL);
3084 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3085 CHECK(calls->handle_announcement_signatures_meth != NULL);
3086 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3087 CHECK(calls->peer_disconnected_meth != NULL);
3088 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3089 CHECK(calls->peer_connected_meth != NULL);
3090 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3091 CHECK(calls->handle_channel_reestablish_meth != NULL);
3092 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3093 CHECK(calls->handle_error_meth != NULL);
3095 LDKChannelMessageHandler ret = {
3096 .this_arg = (void*) calls,
3097 .handle_open_channel = handle_open_channel_jcall,
3098 .handle_accept_channel = handle_accept_channel_jcall,
3099 .handle_funding_created = handle_funding_created_jcall,
3100 .handle_funding_signed = handle_funding_signed_jcall,
3101 .handle_funding_locked = handle_funding_locked_jcall,
3102 .handle_shutdown = handle_shutdown_jcall,
3103 .handle_closing_signed = handle_closing_signed_jcall,
3104 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3105 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3106 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3107 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3108 .handle_commitment_signed = handle_commitment_signed_jcall,
3109 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3110 .handle_update_fee = handle_update_fee_jcall,
3111 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3112 .peer_disconnected = peer_disconnected_jcall,
3113 .peer_connected = peer_connected_jcall,
3114 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3115 .handle_error = handle_error_jcall,
3116 .free = LDKChannelMessageHandler_JCalls_free,
3117 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3119 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3122 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3123 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3124 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3125 return (long)res_ptr;
3127 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3128 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3132 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) {
3133 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3134 LDKPublicKey their_node_id_ref;
3135 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3136 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3137 LDKInitFeatures their_features_conv;
3138 their_features_conv.inner = (void*)(their_features & (~1));
3139 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3140 // Warning: we may need a move here but can't clone!
3141 LDKOpenChannel msg_conv;
3142 msg_conv.inner = (void*)(msg & (~1));
3143 msg_conv.is_owned = (msg & 1) || (msg == 0);
3144 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3147 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) {
3148 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3149 LDKPublicKey their_node_id_ref;
3150 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3151 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3152 LDKInitFeatures their_features_conv;
3153 their_features_conv.inner = (void*)(their_features & (~1));
3154 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3155 // Warning: we may need a move here but can't clone!
3156 LDKAcceptChannel msg_conv;
3157 msg_conv.inner = (void*)(msg & (~1));
3158 msg_conv.is_owned = (msg & 1) || (msg == 0);
3159 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3162 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) {
3163 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3164 LDKPublicKey their_node_id_ref;
3165 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3166 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3167 LDKFundingCreated msg_conv;
3168 msg_conv.inner = (void*)(msg & (~1));
3169 msg_conv.is_owned = (msg & 1) || (msg == 0);
3170 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3173 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) {
3174 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3175 LDKPublicKey their_node_id_ref;
3176 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3177 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3178 LDKFundingSigned msg_conv;
3179 msg_conv.inner = (void*)(msg & (~1));
3180 msg_conv.is_owned = (msg & 1) || (msg == 0);
3181 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3184 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) {
3185 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3186 LDKPublicKey their_node_id_ref;
3187 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3188 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3189 LDKFundingLocked msg_conv;
3190 msg_conv.inner = (void*)(msg & (~1));
3191 msg_conv.is_owned = (msg & 1) || (msg == 0);
3192 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3195 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3196 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3197 LDKPublicKey their_node_id_ref;
3198 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3199 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3200 LDKShutdown msg_conv;
3201 msg_conv.inner = (void*)(msg & (~1));
3202 msg_conv.is_owned = (msg & 1) || (msg == 0);
3203 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3206 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) {
3207 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3208 LDKPublicKey their_node_id_ref;
3209 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3210 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3211 LDKClosingSigned msg_conv;
3212 msg_conv.inner = (void*)(msg & (~1));
3213 msg_conv.is_owned = (msg & 1) || (msg == 0);
3214 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3217 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) {
3218 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3219 LDKPublicKey their_node_id_ref;
3220 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3221 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3222 LDKUpdateAddHTLC msg_conv;
3223 msg_conv.inner = (void*)(msg & (~1));
3224 msg_conv.is_owned = (msg & 1) || (msg == 0);
3225 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3228 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) {
3229 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3230 LDKPublicKey their_node_id_ref;
3231 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3232 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3233 LDKUpdateFulfillHTLC msg_conv;
3234 msg_conv.inner = (void*)(msg & (~1));
3235 msg_conv.is_owned = (msg & 1) || (msg == 0);
3236 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3239 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) {
3240 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3241 LDKPublicKey their_node_id_ref;
3242 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3243 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3244 LDKUpdateFailHTLC msg_conv;
3245 msg_conv.inner = (void*)(msg & (~1));
3246 msg_conv.is_owned = (msg & 1) || (msg == 0);
3247 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3250 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) {
3251 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3252 LDKPublicKey their_node_id_ref;
3253 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3254 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3255 LDKUpdateFailMalformedHTLC msg_conv;
3256 msg_conv.inner = (void*)(msg & (~1));
3257 msg_conv.is_owned = (msg & 1) || (msg == 0);
3258 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3261 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) {
3262 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3263 LDKPublicKey their_node_id_ref;
3264 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3265 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3266 LDKCommitmentSigned msg_conv;
3267 msg_conv.inner = (void*)(msg & (~1));
3268 msg_conv.is_owned = (msg & 1) || (msg == 0);
3269 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3272 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) {
3273 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3274 LDKPublicKey their_node_id_ref;
3275 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3276 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3277 LDKRevokeAndACK msg_conv;
3278 msg_conv.inner = (void*)(msg & (~1));
3279 msg_conv.is_owned = (msg & 1) || (msg == 0);
3280 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3283 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) {
3284 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3285 LDKPublicKey their_node_id_ref;
3286 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3287 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3288 LDKUpdateFee msg_conv;
3289 msg_conv.inner = (void*)(msg & (~1));
3290 msg_conv.is_owned = (msg & 1) || (msg == 0);
3291 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3294 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) {
3295 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3296 LDKPublicKey their_node_id_ref;
3297 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3298 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3299 LDKAnnouncementSignatures msg_conv;
3300 msg_conv.inner = (void*)(msg & (~1));
3301 msg_conv.is_owned = (msg & 1) || (msg == 0);
3302 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3305 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) {
3306 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3307 LDKPublicKey their_node_id_ref;
3308 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3309 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3310 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3313 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3314 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3315 LDKPublicKey their_node_id_ref;
3316 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3317 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3319 msg_conv.inner = (void*)(msg & (~1));
3320 msg_conv.is_owned = (msg & 1) || (msg == 0);
3321 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3324 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) {
3325 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3326 LDKPublicKey their_node_id_ref;
3327 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3328 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3329 LDKChannelReestablish msg_conv;
3330 msg_conv.inner = (void*)(msg & (~1));
3331 msg_conv.is_owned = (msg & 1) || (msg == 0);
3332 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3336 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3337 LDKPublicKey their_node_id_ref;
3338 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3339 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3340 LDKErrorMessage msg_conv;
3341 msg_conv.inner = (void*)(msg & (~1));
3342 msg_conv.is_owned = (msg & 1) || (msg == 0);
3343 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3346 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3347 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3348 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3349 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3350 for (size_t i = 0; i < vec->datalen; i++) {
3351 CHECK((((long)vec->data[i].inner) & 1) == 0);
3352 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3354 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3357 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3358 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3359 ret->datalen = (*env)->GetArrayLength(env, elems);
3360 if (ret->datalen == 0) {
3363 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3364 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3365 for (size_t i = 0; i < ret->datalen; i++) {
3366 jlong arr_elem = java_elems[i];
3367 LDKChannelMonitor arr_elem_conv;
3368 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3369 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3370 // Warning: we may need a move here but can't clone!
3371 ret->data[i] = arr_elem_conv;
3373 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3377 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3378 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3379 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3382 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3383 ret->datalen = (*env)->GetArrayLength(env, elems);
3384 if (ret->datalen == 0) {
3387 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3388 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3389 for (size_t i = 0; i < ret->datalen; i++) {
3390 ret->data[i] = java_elems[i];
3392 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3396 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3397 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3398 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3399 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3400 for (size_t i = 0; i < vec->datalen; i++) {
3401 CHECK((((long)vec->data[i].inner) & 1) == 0);
3402 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3404 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3408 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3409 ret->datalen = (*env)->GetArrayLength(env, elems);
3410 if (ret->datalen == 0) {
3413 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3414 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3415 for (size_t i = 0; i < ret->datalen; i++) {
3416 jlong arr_elem = java_elems[i];
3417 LDKUpdateAddHTLC arr_elem_conv;
3418 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3419 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3420 if (arr_elem_conv.inner != NULL)
3421 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3422 ret->data[i] = arr_elem_conv;
3424 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3428 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3429 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3430 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3431 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3432 for (size_t i = 0; i < vec->datalen; i++) {
3433 CHECK((((long)vec->data[i].inner) & 1) == 0);
3434 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3436 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3439 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3440 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3441 ret->datalen = (*env)->GetArrayLength(env, elems);
3442 if (ret->datalen == 0) {
3445 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3446 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3447 for (size_t i = 0; i < ret->datalen; i++) {
3448 jlong arr_elem = java_elems[i];
3449 LDKUpdateFulfillHTLC arr_elem_conv;
3450 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3451 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3452 if (arr_elem_conv.inner != NULL)
3453 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3454 ret->data[i] = arr_elem_conv;
3456 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3460 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3461 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3462 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3463 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3464 for (size_t i = 0; i < vec->datalen; i++) {
3465 CHECK((((long)vec->data[i].inner) & 1) == 0);
3466 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3468 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3471 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3472 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3473 ret->datalen = (*env)->GetArrayLength(env, elems);
3474 if (ret->datalen == 0) {
3477 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3478 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3479 for (size_t i = 0; i < ret->datalen; i++) {
3480 jlong arr_elem = java_elems[i];
3481 LDKUpdateFailHTLC arr_elem_conv;
3482 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3483 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3484 if (arr_elem_conv.inner != NULL)
3485 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3486 ret->data[i] = arr_elem_conv;
3488 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3492 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3493 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3494 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3495 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3496 for (size_t i = 0; i < vec->datalen; i++) {
3497 CHECK((((long)vec->data[i].inner) & 1) == 0);
3498 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3500 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3504 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3505 ret->datalen = (*env)->GetArrayLength(env, elems);
3506 if (ret->datalen == 0) {
3509 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3510 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3511 for (size_t i = 0; i < ret->datalen; i++) {
3512 jlong arr_elem = java_elems[i];
3513 LDKUpdateFailMalformedHTLC arr_elem_conv;
3514 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3515 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3516 if (arr_elem_conv.inner != NULL)
3517 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3518 ret->data[i] = arr_elem_conv;
3520 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3524 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3525 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3527 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3528 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3529 CHECK(val->result_ok);
3530 return *val->contents.result;
3532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3533 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3534 CHECK(!val->result_ok);
3535 LDKLightningError ret = (*val->contents.err);
3536 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3538 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3539 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3540 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3543 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3544 ret->datalen = (*env)->GetArrayLength(env, elems);
3545 if (ret->datalen == 0) {
3548 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3549 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3550 for (size_t i = 0; i < ret->datalen; i++) {
3551 jlong arr_elem = java_elems[i];
3552 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3553 FREE((void*)arr_elem);
3554 ret->data[i] = arr_elem_conv;
3556 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3560 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3561 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3562 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3563 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3564 for (size_t i = 0; i < vec->datalen; i++) {
3565 CHECK((((long)vec->data[i].inner) & 1) == 0);
3566 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3568 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3572 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3573 ret->datalen = (*env)->GetArrayLength(env, elems);
3574 if (ret->datalen == 0) {
3577 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3578 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3579 for (size_t i = 0; i < ret->datalen; i++) {
3580 jlong arr_elem = java_elems[i];
3581 LDKNodeAnnouncement arr_elem_conv;
3582 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3583 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3584 if (arr_elem_conv.inner != NULL)
3585 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3586 ret->data[i] = arr_elem_conv;
3588 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3592 typedef struct LDKRoutingMessageHandler_JCalls {
3593 atomic_size_t refcnt;
3596 jmethodID handle_node_announcement_meth;
3597 jmethodID handle_channel_announcement_meth;
3598 jmethodID handle_channel_update_meth;
3599 jmethodID handle_htlc_fail_channel_update_meth;
3600 jmethodID get_next_channel_announcements_meth;
3601 jmethodID get_next_node_announcements_meth;
3602 jmethodID should_request_full_sync_meth;
3603 } LDKRoutingMessageHandler_JCalls;
3604 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3605 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3607 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3608 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3610 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3611 LDKCResult_boolLightningErrorZ res = *ret;
3615 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3616 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3618 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3619 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3621 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3622 LDKCResult_boolLightningErrorZ res = *ret;
3626 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3627 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3629 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3630 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3632 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3633 LDKCResult_boolLightningErrorZ res = *ret;
3637 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3638 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3640 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3641 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3643 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3645 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3646 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3648 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3649 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3651 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3652 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3656 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3657 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3659 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3660 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3661 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3662 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3664 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3665 LDKCVec_NodeAnnouncementZ res = *ret;
3669 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3670 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3672 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3673 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3674 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3675 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3677 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3679 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3680 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3681 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3683 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3684 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3688 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3689 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3690 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3691 return (void*) this_arg;
3693 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3694 jclass c = (*env)->GetObjectClass(env, o);
3696 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3697 atomic_init(&calls->refcnt, 1);
3698 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3699 calls->o = (*env)->NewWeakGlobalRef(env, o);
3700 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3701 CHECK(calls->handle_node_announcement_meth != NULL);
3702 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3703 CHECK(calls->handle_channel_announcement_meth != NULL);
3704 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3705 CHECK(calls->handle_channel_update_meth != NULL);
3706 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3707 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3708 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3709 CHECK(calls->get_next_channel_announcements_meth != NULL);
3710 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3711 CHECK(calls->get_next_node_announcements_meth != NULL);
3712 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3713 CHECK(calls->should_request_full_sync_meth != NULL);
3715 LDKRoutingMessageHandler ret = {
3716 .this_arg = (void*) calls,
3717 .handle_node_announcement = handle_node_announcement_jcall,
3718 .handle_channel_announcement = handle_channel_announcement_jcall,
3719 .handle_channel_update = handle_channel_update_jcall,
3720 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3721 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3722 .get_next_node_announcements = get_next_node_announcements_jcall,
3723 .should_request_full_sync = should_request_full_sync_jcall,
3724 .free = LDKRoutingMessageHandler_JCalls_free,
3728 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3729 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3730 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3731 return (long)res_ptr;
3733 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3734 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3739 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3740 LDKNodeAnnouncement msg_conv;
3741 msg_conv.inner = (void*)(msg & (~1));
3742 msg_conv.is_owned = (msg & 1) || (msg == 0);
3743 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3744 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3749 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3750 LDKChannelAnnouncement msg_conv;
3751 msg_conv.inner = (void*)(msg & (~1));
3752 msg_conv.is_owned = (msg & 1) || (msg == 0);
3753 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3754 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3759 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3760 LDKChannelUpdate msg_conv;
3761 msg_conv.inner = (void*)(msg & (~1));
3762 msg_conv.is_owned = (msg & 1) || (msg == 0);
3763 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3764 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3769 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3770 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3771 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3774 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) {
3775 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3776 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3777 *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3781 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) {
3782 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3783 LDKPublicKey starting_point_ref;
3784 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3785 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3786 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3787 *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3791 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3792 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3793 LDKPublicKey node_id_ref;
3794 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3795 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3796 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3800 typedef struct LDKSocketDescriptor_JCalls {
3801 atomic_size_t refcnt;
3804 jmethodID send_data_meth;
3805 jmethodID disconnect_socket_meth;
3807 jmethodID hash_meth;
3808 } LDKSocketDescriptor_JCalls;
3809 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3810 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3812 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3813 LDKu8slice data_var = data;
3814 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
3815 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
3816 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3818 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
3820 void disconnect_socket_jcall(void* this_arg) {
3821 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3823 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3824 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3826 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
3828 bool eq_jcall(const void* this_arg, const void *other_arg) {
3829 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3831 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3832 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3834 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
3836 uint64_t hash_jcall(const void* this_arg) {
3837 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3839 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3840 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3842 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
3844 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3845 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3846 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3848 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3849 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3853 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3854 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3855 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3856 return (void*) this_arg;
3858 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3859 jclass c = (*env)->GetObjectClass(env, o);
3861 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3862 atomic_init(&calls->refcnt, 1);
3863 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3864 calls->o = (*env)->NewWeakGlobalRef(env, o);
3865 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3866 CHECK(calls->send_data_meth != NULL);
3867 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3868 CHECK(calls->disconnect_socket_meth != NULL);
3869 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3870 CHECK(calls->eq_meth != NULL);
3871 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3872 CHECK(calls->hash_meth != NULL);
3874 LDKSocketDescriptor ret = {
3875 .this_arg = (void*) calls,
3876 .send_data = send_data_jcall,
3877 .disconnect_socket = disconnect_socket_jcall,
3880 .clone = LDKSocketDescriptor_JCalls_clone,
3881 .free = LDKSocketDescriptor_JCalls_free,
3885 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3886 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3887 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3888 return (long)res_ptr;
3890 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3891 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
3896 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3897 LDKu8slice data_ref;
3898 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
3899 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
3900 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
3901 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
3905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
3906 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3907 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
3910 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
3911 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3912 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
3916 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3917 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3918 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3920 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3921 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3923 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3924 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3925 CHECK(val->result_ok);
3926 LDKCVecTempl_u8 arg_var = (*val->contents.result);
3927 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
3928 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
3931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3932 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3933 CHECK(!val->result_ok);
3934 LDKPeerHandleError ret = (*val->contents.err);
3935 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3937 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3938 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3940 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3941 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3942 CHECK(val->result_ok);
3943 return *val->contents.result;
3945 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3946 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3947 CHECK(!val->result_ok);
3948 LDKPeerHandleError ret = (*val->contents.err);
3949 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3951 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3952 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3954 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3955 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3956 CHECK(val->result_ok);
3957 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
3958 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (*val->contents.result).bytes);
3961 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3962 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3963 CHECK(!val->result_ok);
3964 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3967 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3968 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3970 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3971 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3972 CHECK(val->result_ok);
3973 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
3974 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (*val->contents.result).compressed_form);
3977 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3978 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3979 CHECK(!val->result_ok);
3980 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3983 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3984 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3987 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3988 CHECK(val->result_ok);
3989 LDKTxCreationKeys ret = (*val->contents.result);
3990 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
3992 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3993 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3994 CHECK(!val->result_ok);
3995 jclass ret = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
3998 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3999 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4000 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4002 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4003 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4004 ret->datalen = (*env)->GetArrayLength(env, elems);
4005 if (ret->datalen == 0) {
4008 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4009 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4010 for (size_t i = 0; i < ret->datalen; i++) {
4011 jlong arr_elem = java_elems[i];
4012 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4013 FREE((void*)arr_elem);
4014 ret->data[i] = arr_elem_conv;
4016 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4020 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4021 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4022 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4023 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4024 for (size_t i = 0; i < vec->datalen; i++) {
4025 CHECK((((long)vec->data[i].inner) & 1) == 0);
4026 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4028 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4032 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4033 ret->datalen = (*env)->GetArrayLength(env, elems);
4034 if (ret->datalen == 0) {
4037 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4038 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4039 for (size_t i = 0; i < ret->datalen; i++) {
4040 jlong arr_elem = java_elems[i];
4041 LDKRouteHop arr_elem_conv;
4042 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4043 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4044 if (arr_elem_conv.inner != NULL)
4045 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4046 ret->data[i] = arr_elem_conv;
4048 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4052 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4053 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4054 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4057 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
4058 ret->datalen = (*env)->GetArrayLength(env, elems);
4059 if (ret->datalen == 0) {
4062 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
4063 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4064 for (size_t i = 0; i < ret->datalen; i++) {
4065 jlong arr_elem = java_elems[i];
4066 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
4067 FREE((void*)arr_elem);
4068 ret->data[i] = arr_elem_conv;
4070 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4074 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4075 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4078 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4079 CHECK(val->result_ok);
4080 LDKRoute ret = (*val->contents.result);
4081 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4083 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4084 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4085 CHECK(!val->result_ok);
4086 LDKLightningError ret = (*val->contents.err);
4087 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4089 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4090 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4091 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4092 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4093 for (size_t i = 0; i < vec->datalen; i++) {
4094 CHECK((((long)vec->data[i].inner) & 1) == 0);
4095 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4097 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4101 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4102 ret->datalen = (*env)->GetArrayLength(env, elems);
4103 if (ret->datalen == 0) {
4106 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4107 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4108 for (size_t i = 0; i < ret->datalen; i++) {
4109 jlong arr_elem = java_elems[i];
4110 LDKRouteHint arr_elem_conv;
4111 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4112 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4113 if (arr_elem_conv.inner != NULL)
4114 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4115 ret->data[i] = arr_elem_conv;
4117 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4122 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4124 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4128 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4130 C2Tuple_OutPointScriptZ_free(arg_conv);
4133 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4134 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4136 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4140 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4142 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4146 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4148 C2Tuple_u64u64Z_free(arg_conv);
4151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4152 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4154 C2Tuple_usizeTransactionZ_free(arg_conv);
4157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4158 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4160 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4164 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4166 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4170 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4172 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4173 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4178 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4180 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4184 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4186 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4187 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4191 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4192 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4194 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4195 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4200 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4202 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4206 LDKCVec_u8Z arg_ref;
4207 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4208 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4209 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4210 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4211 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4216 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4218 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4219 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4224 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4226 CResult_NoneAPIErrorZ_free(arg_conv);
4229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4230 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4232 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4233 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4238 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4240 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4243 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4244 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4246 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4247 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4252 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4254 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4257 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4258 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4260 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4261 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4265 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4266 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4268 CResult_NonePaymentSendFailureZ_free(arg_conv);
4271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4272 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4274 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4275 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4279 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4280 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4282 CResult_NonePeerHandleErrorZ_free(arg_conv);
4285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4286 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4288 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4289 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4294 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4296 CResult_PublicKeySecpErrorZ_free(arg_conv);
4299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4300 LDKPublicKey arg_ref;
4301 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4302 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4303 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4304 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4309 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4311 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4312 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4316 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4317 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4319 CResult_RouteLightningErrorZ_free(arg_conv);
4322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4323 LDKRoute arg_conv = *(LDKRoute*)arg;
4325 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4326 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4330 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4331 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4333 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4334 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4338 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4339 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4341 CResult_SecretKeySecpErrorZ_free(arg_conv);
4344 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4345 LDKSecretKey arg_ref;
4346 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4347 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4348 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4349 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4353 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4354 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4356 CResult_SignatureNoneZ_free(arg_conv);
4359 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4360 LDKSignature arg_ref;
4361 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4362 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4363 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4364 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4368 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4369 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4371 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4372 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4377 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4379 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4382 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4383 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4385 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4386 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4391 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4393 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4394 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4399 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4401 CResult_TxOutAccessErrorZ_free(arg_conv);
4404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4405 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4407 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4408 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4413 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4415 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4416 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4421 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4423 CResult_boolLightningErrorZ_free(arg_conv);
4426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4427 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4428 *ret = CResult_boolLightningErrorZ_ok(arg);
4432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4433 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4435 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4436 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4443 CResult_boolPeerHandleErrorZ_free(arg_conv);
4446 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4447 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4448 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4453 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4455 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4459 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4461 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4465 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4467 CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4470 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4471 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4473 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4477 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4479 CVec_CVec_RouteHopZZ_free(arg_conv);
4482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4483 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4485 CVec_ChannelDetailsZ_free(arg_conv);
4488 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4489 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4491 CVec_ChannelMonitorZ_free(arg_conv);
4494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4495 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4497 CVec_EventZ_free(arg_conv);
4500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4501 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4503 CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4507 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4509 CVec_MessageSendEventZ_free(arg_conv);
4512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4513 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4515 CVec_MonitorEventZ_free(arg_conv);
4518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4519 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4521 CVec_NetAddressZ_free(arg_conv);
4524 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4525 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4527 CVec_NodeAnnouncementZ_free(arg_conv);
4530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4531 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4533 CVec_PublicKeyZ_free(arg_conv);
4536 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4537 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4539 CVec_RouteHintZ_free(arg_conv);
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4543 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4545 CVec_RouteHopZ_free(arg_conv);
4548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4549 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4551 CVec_SignatureZ_free(arg_conv);
4554 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4555 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4557 CVec_SpendableOutputDescriptorZ_free(arg_conv);
4560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4561 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4563 CVec_TransactionZ_free(arg_conv);
4566 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4567 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4569 CVec_TxOutZ_free(arg_conv);
4572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4573 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4575 CVec_UpdateAddHTLCZ_free(arg_conv);
4578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4579 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4581 CVec_UpdateFailHTLCZ_free(arg_conv);
4584 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4585 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4587 CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4590 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4591 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4593 CVec_UpdateFulfillHTLCZ_free(arg_conv);
4596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4597 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4599 CVec_u64Z_free(arg_conv);
4602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
4603 LDKCVec_u8Z arg_ref;
4604 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4605 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4606 CVec_u8Z_free(arg_ref);
4607 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4611 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4613 Transaction_free(_res_conv);
4616 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4617 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4619 TxOut_free(_res_conv);
4622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4623 LDKTransaction b_conv = *(LDKTransaction*)b;
4625 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4626 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4631 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4632 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4637 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4638 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
4644 a_conv.inner = (void*)(a & (~1));
4645 a_conv.is_owned = (a & 1) || (a == 0);
4646 if (a_conv.inner != NULL)
4647 a_conv = OutPoint_clone(&a_conv);
4649 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
4650 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
4651 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4652 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
4653 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
4657 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4658 LDKThirtyTwoBytes a_ref;
4659 CHECK((*_env)->GetArrayLength (_env, a) == 32);
4660 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4661 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4663 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4664 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4669 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4670 *ret = C2Tuple_u64u64Z_new(a, b);
4674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4676 CHECK((*_env)->GetArrayLength (_env, a) == 64);
4677 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
4678 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4680 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4681 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_conv);
4685 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4686 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4687 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4691 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4692 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4693 *ret = CResult_SignatureNoneZ_err();
4697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4698 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4699 *ret = CResult_CVec_SignatureZNoneZ_err();
4703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4704 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4705 *ret = CResult_NoneAPIErrorZ_ok();
4709 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4710 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4711 *ret = CResult_NonePaymentSendFailureZ_ok();
4715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4716 LDKChannelAnnouncement a_conv;
4717 a_conv.inner = (void*)(a & (~1));
4718 a_conv.is_owned = (a & 1) || (a == 0);
4719 if (a_conv.inner != NULL)
4720 a_conv = ChannelAnnouncement_clone(&a_conv);
4721 LDKChannelUpdate b_conv;
4722 b_conv.inner = (void*)(b & (~1));
4723 b_conv.is_owned = (b & 1) || (b == 0);
4724 if (b_conv.inner != NULL)
4725 b_conv = ChannelUpdate_clone(&b_conv);
4726 LDKChannelUpdate c_conv;
4727 c_conv.inner = (void*)(c & (~1));
4728 c_conv.is_owned = (c & 1) || (c == 0);
4729 if (c_conv.inner != NULL)
4730 c_conv = ChannelUpdate_clone(&c_conv);
4731 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4732 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4737 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4738 *ret = CResult_NonePeerHandleErrorZ_ok();
4742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
4743 LDKHTLCOutputInCommitment a_conv;
4744 a_conv.inner = (void*)(a & (~1));
4745 a_conv.is_owned = (a & 1) || (a == 0);
4746 if (a_conv.inner != NULL)
4747 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4749 CHECK((*_env)->GetArrayLength (_env, b) == 64);
4750 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
4751 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4752 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
4756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4757 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4758 FREE((void*)this_ptr);
4759 Event_free(this_ptr_conv);
4762 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4763 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4764 FREE((void*)this_ptr);
4765 MessageSendEvent_free(this_ptr_conv);
4768 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4769 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4770 FREE((void*)this_ptr);
4771 MessageSendEventsProvider_free(this_ptr_conv);
4774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4775 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4776 FREE((void*)this_ptr);
4777 EventsProvider_free(this_ptr_conv);
4780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4781 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4782 FREE((void*)this_ptr);
4783 APIError_free(this_ptr_conv);
4786 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4787 jclass ret = LDKLevel_to_java(_env, Level_max());
4791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4792 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4793 FREE((void*)this_ptr);
4794 Logger_free(this_ptr_conv);
4797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4798 LDKChannelHandshakeConfig this_ptr_conv;
4799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4801 ChannelHandshakeConfig_free(this_ptr_conv);
4804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4805 LDKChannelHandshakeConfig orig_conv;
4806 orig_conv.inner = (void*)(orig & (~1));
4807 orig_conv.is_owned = (orig & 1) || (orig == 0);
4808 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4809 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4812 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4813 LDKChannelHandshakeConfig this_ptr_conv;
4814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4816 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4821 LDKChannelHandshakeConfig this_ptr_conv;
4822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4824 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4827 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4828 LDKChannelHandshakeConfig this_ptr_conv;
4829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4831 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4836 LDKChannelHandshakeConfig this_ptr_conv;
4837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4839 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4843 LDKChannelHandshakeConfig this_ptr_conv;
4844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4846 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4851 LDKChannelHandshakeConfig this_ptr_conv;
4852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4854 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4857 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) {
4858 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4859 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4863 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4864 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4867 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4868 LDKChannelHandshakeLimits this_ptr_conv;
4869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4871 ChannelHandshakeLimits_free(this_ptr_conv);
4874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4875 LDKChannelHandshakeLimits orig_conv;
4876 orig_conv.inner = (void*)(orig & (~1));
4877 orig_conv.is_owned = (orig & 1) || (orig == 0);
4878 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4879 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4883 LDKChannelHandshakeLimits this_ptr_conv;
4884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4886 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4890 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4891 LDKChannelHandshakeLimits this_ptr_conv;
4892 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4893 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4894 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4898 LDKChannelHandshakeLimits this_ptr_conv;
4899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4901 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4906 LDKChannelHandshakeLimits this_ptr_conv;
4907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4909 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4913 LDKChannelHandshakeLimits this_ptr_conv;
4914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4916 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4920 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) {
4921 LDKChannelHandshakeLimits this_ptr_conv;
4922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4924 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4928 LDKChannelHandshakeLimits this_ptr_conv;
4929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4931 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4936 LDKChannelHandshakeLimits this_ptr_conv;
4937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4939 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4942 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4943 LDKChannelHandshakeLimits this_ptr_conv;
4944 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4945 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4946 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4950 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4951 LDKChannelHandshakeLimits this_ptr_conv;
4952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4954 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4957 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4958 LDKChannelHandshakeLimits this_ptr_conv;
4959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4961 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4966 LDKChannelHandshakeLimits this_ptr_conv;
4967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4969 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4972 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4973 LDKChannelHandshakeLimits this_ptr_conv;
4974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4976 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4981 LDKChannelHandshakeLimits this_ptr_conv;
4982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4984 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4987 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4988 LDKChannelHandshakeLimits this_ptr_conv;
4989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4991 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4995 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4996 LDKChannelHandshakeLimits this_ptr_conv;
4997 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4998 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4999 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5002 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5003 LDKChannelHandshakeLimits this_ptr_conv;
5004 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5005 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5006 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5011 LDKChannelHandshakeLimits this_ptr_conv;
5012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5014 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5017 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5018 LDKChannelHandshakeLimits this_ptr_conv;
5019 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5020 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5021 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5025 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5026 LDKChannelHandshakeLimits this_ptr_conv;
5027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5029 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5032 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) {
5033 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);
5034 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5038 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5039 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5043 LDKChannelConfig this_ptr_conv;
5044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5046 ChannelConfig_free(this_ptr_conv);
5049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5050 LDKChannelConfig orig_conv;
5051 orig_conv.inner = (void*)(orig & (~1));
5052 orig_conv.is_owned = (orig & 1) || (orig == 0);
5053 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5054 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5057 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5058 LDKChannelConfig this_ptr_conv;
5059 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5060 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5061 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5066 LDKChannelConfig this_ptr_conv;
5067 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5068 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5069 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5072 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5073 LDKChannelConfig this_ptr_conv;
5074 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5075 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5076 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5081 LDKChannelConfig this_ptr_conv;
5082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5084 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5087 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5088 LDKChannelConfig this_ptr_conv;
5089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5091 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5096 LDKChannelConfig this_ptr_conv;
5097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5099 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5102 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) {
5103 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5104 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5108 LDKChannelConfig ret = ChannelConfig_default();
5109 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5112 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5113 LDKChannelConfig obj_conv;
5114 obj_conv.inner = (void*)(obj & (~1));
5115 obj_conv.is_owned = (obj & 1) || (obj == 0);
5116 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5117 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5118 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5124 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5125 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5126 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5127 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5128 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5132 LDKUserConfig this_ptr_conv;
5133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5135 UserConfig_free(this_ptr_conv);
5138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5139 LDKUserConfig orig_conv;
5140 orig_conv.inner = (void*)(orig & (~1));
5141 orig_conv.is_owned = (orig & 1) || (orig == 0);
5142 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5143 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5147 LDKUserConfig this_ptr_conv;
5148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5150 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5151 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5155 LDKUserConfig this_ptr_conv;
5156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5158 LDKChannelHandshakeConfig val_conv;
5159 val_conv.inner = (void*)(val & (~1));
5160 val_conv.is_owned = (val & 1) || (val == 0);
5161 if (val_conv.inner != NULL)
5162 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5163 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5167 LDKUserConfig this_ptr_conv;
5168 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5169 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5170 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5171 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5175 LDKUserConfig this_ptr_conv;
5176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5178 LDKChannelHandshakeLimits val_conv;
5179 val_conv.inner = (void*)(val & (~1));
5180 val_conv.is_owned = (val & 1) || (val == 0);
5181 if (val_conv.inner != NULL)
5182 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5183 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5187 LDKUserConfig this_ptr_conv;
5188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5190 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5191 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5194 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5195 LDKUserConfig this_ptr_conv;
5196 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5197 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5198 LDKChannelConfig val_conv;
5199 val_conv.inner = (void*)(val & (~1));
5200 val_conv.is_owned = (val & 1) || (val == 0);
5201 if (val_conv.inner != NULL)
5202 val_conv = ChannelConfig_clone(&val_conv);
5203 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5206 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) {
5207 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5208 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5209 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5210 if (own_channel_config_arg_conv.inner != NULL)
5211 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5212 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5213 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5214 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5215 if (peer_channel_config_limits_arg_conv.inner != NULL)
5216 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5217 LDKChannelConfig channel_options_arg_conv;
5218 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5219 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5220 if (channel_options_arg_conv.inner != NULL)
5221 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5222 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5223 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5227 LDKUserConfig ret = UserConfig_default();
5228 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5232 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5233 FREE((void*)this_ptr);
5234 Access_free(this_ptr_conv);
5237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5238 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5239 FREE((void*)this_ptr);
5240 Watch_free(this_ptr_conv);
5243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5244 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5245 FREE((void*)this_ptr);
5246 Filter_free(this_ptr_conv);
5249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5250 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5251 FREE((void*)this_ptr);
5252 BroadcasterInterface_free(this_ptr_conv);
5255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5256 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5257 FREE((void*)this_ptr);
5258 FeeEstimator_free(this_ptr_conv);
5261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5262 LDKChainMonitor this_ptr_conv;
5263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5265 ChainMonitor_free(this_ptr_conv);
5268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5269 LDKChainMonitor this_arg_conv;
5270 this_arg_conv.inner = (void*)(this_arg & (~1));
5271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5272 unsigned char header_arr[80];
5273 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5274 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5275 unsigned char (*header_ref)[80] = &header_arr;
5276 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5277 FREE((void*)txdata);
5278 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5282 LDKChainMonitor this_arg_conv;
5283 this_arg_conv.inner = (void*)(this_arg & (~1));
5284 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5285 unsigned char header_arr[80];
5286 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5287 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5288 unsigned char (*header_ref)[80] = &header_arr;
5289 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5292 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5293 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5294 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5295 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5296 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5297 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5299 LDKLogger logger_conv = *(LDKLogger*)logger;
5300 if (logger_conv.free == LDKLogger_JCalls_free) {
5301 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5302 LDKLogger_JCalls_clone(logger_conv.this_arg);
5304 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5305 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5306 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5307 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5309 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5310 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5314 LDKChainMonitor this_arg_conv;
5315 this_arg_conv.inner = (void*)(this_arg & (~1));
5316 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5317 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5318 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5323 LDKChainMonitor this_arg_conv;
5324 this_arg_conv.inner = (void*)(this_arg & (~1));
5325 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5326 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5327 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5332 LDKChannelMonitorUpdate this_ptr_conv;
5333 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5334 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5335 ChannelMonitorUpdate_free(this_ptr_conv);
5338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5339 LDKChannelMonitorUpdate orig_conv;
5340 orig_conv.inner = (void*)(orig & (~1));
5341 orig_conv.is_owned = (orig & 1) || (orig == 0);
5342 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5343 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5347 LDKChannelMonitorUpdate this_ptr_conv;
5348 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5349 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5350 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5355 LDKChannelMonitorUpdate this_ptr_conv;
5356 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5357 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5358 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5361 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5362 LDKChannelMonitorUpdate obj_conv;
5363 obj_conv.inner = (void*)(obj & (~1));
5364 obj_conv.is_owned = (obj & 1) || (obj == 0);
5365 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5366 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5367 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5373 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5374 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5375 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5376 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5377 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5381 LDKMonitorUpdateError this_ptr_conv;
5382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5384 MonitorUpdateError_free(this_ptr_conv);
5387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5388 LDKMonitorEvent this_ptr_conv;
5389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5391 MonitorEvent_free(this_ptr_conv);
5394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5395 LDKHTLCUpdate this_ptr_conv;
5396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5398 HTLCUpdate_free(this_ptr_conv);
5401 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5402 LDKHTLCUpdate orig_conv;
5403 orig_conv.inner = (void*)(orig & (~1));
5404 orig_conv.is_owned = (orig & 1) || (orig == 0);
5405 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5406 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5409 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5410 LDKHTLCUpdate obj_conv;
5411 obj_conv.inner = (void*)(obj & (~1));
5412 obj_conv.is_owned = (obj & 1) || (obj == 0);
5413 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
5414 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5415 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5421 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5422 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5423 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5424 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5425 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5429 LDKChannelMonitor this_ptr_conv;
5430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5432 ChannelMonitor_free(this_ptr_conv);
5435 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5436 LDKChannelMonitor this_arg_conv;
5437 this_arg_conv.inner = (void*)(this_arg & (~1));
5438 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5439 LDKChannelMonitorUpdate updates_conv;
5440 updates_conv.inner = (void*)(updates & (~1));
5441 updates_conv.is_owned = (updates & 1) || (updates == 0);
5442 if (updates_conv.inner != NULL)
5443 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5444 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5445 LDKLogger* logger_conv = (LDKLogger*)logger;
5446 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5447 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5452 LDKChannelMonitor this_arg_conv;
5453 this_arg_conv.inner = (void*)(this_arg & (~1));
5454 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5455 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5460 LDKChannelMonitor this_arg_conv;
5461 this_arg_conv.inner = (void*)(this_arg & (~1));
5462 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5463 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5464 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5469 LDKChannelMonitor this_arg_conv;
5470 this_arg_conv.inner = (void*)(this_arg & (~1));
5471 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5472 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5473 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5477 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5478 LDKChannelMonitor this_arg_conv;
5479 this_arg_conv.inner = (void*)(this_arg & (~1));
5480 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5481 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5482 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5487 LDKChannelMonitor this_arg_conv;
5488 this_arg_conv.inner = (void*)(this_arg & (~1));
5489 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5490 LDKLogger* logger_conv = (LDKLogger*)logger;
5491 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5492 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5496 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) {
5497 LDKChannelMonitor this_arg_conv;
5498 this_arg_conv.inner = (void*)(this_arg & (~1));
5499 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5500 unsigned char header_arr[80];
5501 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5502 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5503 unsigned char (*header_ref)[80] = &header_arr;
5504 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5505 FREE((void*)txdata);
5506 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5507 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5508 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5509 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5511 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5512 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5513 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5514 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5516 LDKLogger logger_conv = *(LDKLogger*)logger;
5517 if (logger_conv.free == LDKLogger_JCalls_free) {
5518 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5519 LDKLogger_JCalls_clone(logger_conv.this_arg);
5521 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5522 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5526 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) {
5527 LDKChannelMonitor this_arg_conv;
5528 this_arg_conv.inner = (void*)(this_arg & (~1));
5529 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5530 unsigned char header_arr[80];
5531 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5532 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5533 unsigned char (*header_ref)[80] = &header_arr;
5534 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5535 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5536 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5537 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5539 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5540 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5541 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5542 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5544 LDKLogger logger_conv = *(LDKLogger*)logger;
5545 if (logger_conv.free == LDKLogger_JCalls_free) {
5546 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5547 LDKLogger_JCalls_clone(logger_conv.this_arg);
5549 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5553 LDKOutPoint this_ptr_conv;
5554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5556 OutPoint_free(this_ptr_conv);
5559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5560 LDKOutPoint orig_conv;
5561 orig_conv.inner = (void*)(orig & (~1));
5562 orig_conv.is_owned = (orig & 1) || (orig == 0);
5563 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5564 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5567 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5568 LDKOutPoint this_ptr_conv;
5569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5571 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5572 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5576 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5577 LDKOutPoint this_ptr_conv;
5578 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5579 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5580 LDKThirtyTwoBytes val_ref;
5581 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5582 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5583 OutPoint_set_txid(&this_ptr_conv, val_ref);
5586 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5587 LDKOutPoint this_ptr_conv;
5588 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5589 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5590 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
5594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5595 LDKOutPoint this_ptr_conv;
5596 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5597 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5598 OutPoint_set_index(&this_ptr_conv, val);
5601 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5602 LDKThirtyTwoBytes txid_arg_ref;
5603 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
5604 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5605 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5606 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5609 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5610 LDKOutPoint this_arg_conv;
5611 this_arg_conv.inner = (void*)(this_arg & (~1));
5612 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5613 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5614 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5618 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5619 LDKOutPoint obj_conv;
5620 obj_conv.inner = (void*)(obj & (~1));
5621 obj_conv.is_owned = (obj & 1) || (obj == 0);
5622 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
5623 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5624 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5630 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5631 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5632 LDKOutPoint ret = OutPoint_read(ser_ref);
5633 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5634 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5638 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5639 FREE((void*)this_ptr);
5640 SpendableOutputDescriptor_free(this_ptr_conv);
5643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5644 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5645 FREE((void*)this_ptr);
5646 ChannelKeys_free(this_ptr_conv);
5649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5650 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5651 FREE((void*)this_ptr);
5652 KeysInterface_free(this_ptr_conv);
5655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5656 LDKInMemoryChannelKeys this_ptr_conv;
5657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5659 InMemoryChannelKeys_free(this_ptr_conv);
5662 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5663 LDKInMemoryChannelKeys orig_conv;
5664 orig_conv.inner = (void*)(orig & (~1));
5665 orig_conv.is_owned = (orig & 1) || (orig == 0);
5666 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5667 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5671 LDKInMemoryChannelKeys this_ptr_conv;
5672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5674 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5675 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5680 LDKInMemoryChannelKeys this_ptr_conv;
5681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5683 LDKSecretKey val_ref;
5684 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5685 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5686 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5690 LDKInMemoryChannelKeys this_ptr_conv;
5691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5693 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5694 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5699 LDKInMemoryChannelKeys this_ptr_conv;
5700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5702 LDKSecretKey val_ref;
5703 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5704 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5705 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5709 LDKInMemoryChannelKeys this_ptr_conv;
5710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5712 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5713 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5718 LDKInMemoryChannelKeys this_ptr_conv;
5719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5721 LDKSecretKey val_ref;
5722 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5723 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5724 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5727 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5728 LDKInMemoryChannelKeys this_ptr_conv;
5729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5731 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5732 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5736 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5737 LDKInMemoryChannelKeys this_ptr_conv;
5738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5740 LDKSecretKey val_ref;
5741 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5742 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5743 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5746 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5747 LDKInMemoryChannelKeys this_ptr_conv;
5748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5750 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5751 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5756 LDKInMemoryChannelKeys this_ptr_conv;
5757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5759 LDKSecretKey val_ref;
5760 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5761 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5762 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
5765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5766 LDKInMemoryChannelKeys this_ptr_conv;
5767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5769 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5770 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5774 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5775 LDKInMemoryChannelKeys this_ptr_conv;
5776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5778 LDKThirtyTwoBytes val_ref;
5779 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5780 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5781 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5784 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) {
5785 LDKSecretKey funding_key_ref;
5786 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
5787 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
5788 LDKSecretKey revocation_base_key_ref;
5789 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
5790 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
5791 LDKSecretKey payment_key_ref;
5792 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
5793 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
5794 LDKSecretKey delayed_payment_base_key_ref;
5795 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
5796 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
5797 LDKSecretKey htlc_base_key_ref;
5798 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
5799 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
5800 LDKThirtyTwoBytes commitment_seed_ref;
5801 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
5802 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5803 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5804 FREE((void*)key_derivation_params);
5805 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);
5806 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5810 LDKInMemoryChannelKeys this_arg_conv;
5811 this_arg_conv.inner = (void*)(this_arg & (~1));
5812 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5813 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5814 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5817 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5818 LDKInMemoryChannelKeys this_arg_conv;
5819 this_arg_conv.inner = (void*)(this_arg & (~1));
5820 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5821 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5825 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5826 LDKInMemoryChannelKeys this_arg_conv;
5827 this_arg_conv.inner = (void*)(this_arg & (~1));
5828 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5829 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5833 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5834 LDKInMemoryChannelKeys this_arg_conv;
5835 this_arg_conv.inner = (void*)(this_arg & (~1));
5836 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5837 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5838 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5842 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5843 LDKInMemoryChannelKeys obj_conv;
5844 obj_conv.inner = (void*)(obj & (~1));
5845 obj_conv.is_owned = (obj & 1) || (obj == 0);
5846 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
5847 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5848 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5854 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5855 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5856 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
5857 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5858 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5862 LDKKeysManager this_ptr_conv;
5863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5865 KeysManager_free(this_ptr_conv);
5868 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) {
5869 unsigned char seed_arr[32];
5870 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
5871 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5872 unsigned char (*seed_ref)[32] = &seed_arr;
5873 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5874 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5875 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5878 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) {
5879 LDKKeysManager this_arg_conv;
5880 this_arg_conv.inner = (void*)(this_arg & (~1));
5881 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5882 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5883 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5887 LDKKeysManager this_arg_conv;
5888 this_arg_conv.inner = (void*)(this_arg & (~1));
5889 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5890 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5891 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5896 LDKChannelManager this_ptr_conv;
5897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5899 ChannelManager_free(this_ptr_conv);
5902 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5903 LDKChannelDetails this_ptr_conv;
5904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5906 ChannelDetails_free(this_ptr_conv);
5909 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5910 LDKChannelDetails orig_conv;
5911 orig_conv.inner = (void*)(orig & (~1));
5912 orig_conv.is_owned = (orig & 1) || (orig == 0);
5913 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
5914 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5917 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5918 LDKChannelDetails this_ptr_conv;
5919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5921 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5922 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5927 LDKChannelDetails this_ptr_conv;
5928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5930 LDKThirtyTwoBytes val_ref;
5931 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5932 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5933 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5936 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5937 LDKChannelDetails this_ptr_conv;
5938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5940 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5941 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5946 LDKChannelDetails this_ptr_conv;
5947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5949 LDKPublicKey val_ref;
5950 CHECK((*_env)->GetArrayLength (_env, val) == 33);
5951 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5952 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5955 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5956 LDKChannelDetails this_ptr_conv;
5957 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5958 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5959 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5960 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5964 LDKChannelDetails this_ptr_conv;
5965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5967 LDKInitFeatures val_conv;
5968 val_conv.inner = (void*)(val & (~1));
5969 val_conv.is_owned = (val & 1) || (val == 0);
5970 // Warning: we may need a move here but can't clone!
5971 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5983 LDKChannelDetails this_ptr_conv;
5984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5986 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
5997 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5998 LDKChannelDetails this_ptr_conv;
5999 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6000 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6001 ChannelDetails_set_user_id(&this_ptr_conv, val);
6004 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6013 LDKChannelDetails this_ptr_conv;
6014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6016 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6019 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6027 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6028 LDKChannelDetails this_ptr_conv;
6029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6031 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6034 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6035 LDKChannelDetails this_ptr_conv;
6036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6038 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6042 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6043 LDKChannelDetails this_ptr_conv;
6044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6046 ChannelDetails_set_is_live(&this_ptr_conv, val);
6049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6050 LDKPaymentSendFailure this_ptr_conv;
6051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6053 PaymentSendFailure_free(this_ptr_conv);
6056 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) {
6057 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6058 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6059 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6060 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6061 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6063 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6064 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6065 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6066 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6068 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6069 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6070 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6071 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6073 LDKLogger logger_conv = *(LDKLogger*)logger;
6074 if (logger_conv.free == LDKLogger_JCalls_free) {
6075 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6076 LDKLogger_JCalls_clone(logger_conv.this_arg);
6078 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6079 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6080 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6081 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6083 LDKUserConfig config_conv;
6084 config_conv.inner = (void*)(config & (~1));
6085 config_conv.is_owned = (config & 1) || (config == 0);
6086 if (config_conv.inner != NULL)
6087 config_conv = UserConfig_clone(&config_conv);
6088 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);
6089 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6092 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) {
6093 LDKChannelManager this_arg_conv;
6094 this_arg_conv.inner = (void*)(this_arg & (~1));
6095 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6096 LDKPublicKey their_network_key_ref;
6097 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6098 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6099 LDKUserConfig override_config_conv;
6100 override_config_conv.inner = (void*)(override_config & (~1));
6101 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6102 if (override_config_conv.inner != NULL)
6103 override_config_conv = UserConfig_clone(&override_config_conv);
6104 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6105 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6110 LDKChannelManager this_arg_conv;
6111 this_arg_conv.inner = (void*)(this_arg & (~1));
6112 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6113 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6114 *ret = ChannelManager_list_channels(&this_arg_conv);
6118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6119 LDKChannelManager this_arg_conv;
6120 this_arg_conv.inner = (void*)(this_arg & (~1));
6121 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6122 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6123 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6128 LDKChannelManager this_arg_conv;
6129 this_arg_conv.inner = (void*)(this_arg & (~1));
6130 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6131 unsigned char channel_id_arr[32];
6132 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6133 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6134 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6135 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6136 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6141 LDKChannelManager this_arg_conv;
6142 this_arg_conv.inner = (void*)(this_arg & (~1));
6143 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6144 unsigned char channel_id_arr[32];
6145 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6146 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6147 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6148 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6152 LDKChannelManager this_arg_conv;
6153 this_arg_conv.inner = (void*)(this_arg & (~1));
6154 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6155 ChannelManager_force_close_all_channels(&this_arg_conv);
6158 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) {
6159 LDKChannelManager this_arg_conv;
6160 this_arg_conv.inner = (void*)(this_arg & (~1));
6161 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6162 LDKRoute route_conv;
6163 route_conv.inner = (void*)(route & (~1));
6164 route_conv.is_owned = (route & 1) || (route == 0);
6165 LDKThirtyTwoBytes payment_hash_ref;
6166 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6167 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6168 LDKThirtyTwoBytes payment_secret_ref;
6169 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6170 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6171 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6172 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6176 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) {
6177 LDKChannelManager this_arg_conv;
6178 this_arg_conv.inner = (void*)(this_arg & (~1));
6179 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6180 unsigned char temporary_channel_id_arr[32];
6181 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6182 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6183 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6184 LDKOutPoint funding_txo_conv;
6185 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6186 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6187 if (funding_txo_conv.inner != NULL)
6188 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6189 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6192 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) {
6193 LDKChannelManager this_arg_conv;
6194 this_arg_conv.inner = (void*)(this_arg & (~1));
6195 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6196 LDKThreeBytes rgb_ref;
6197 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6198 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6199 LDKThirtyTwoBytes alias_ref;
6200 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6201 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6202 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
6203 FREE((void*)addresses);
6204 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_conv);
6207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6208 LDKChannelManager this_arg_conv;
6209 this_arg_conv.inner = (void*)(this_arg & (~1));
6210 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6211 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6215 LDKChannelManager this_arg_conv;
6216 this_arg_conv.inner = (void*)(this_arg & (~1));
6217 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6218 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6221 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) {
6222 LDKChannelManager this_arg_conv;
6223 this_arg_conv.inner = (void*)(this_arg & (~1));
6224 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6225 unsigned char payment_hash_arr[32];
6226 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6227 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6228 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6229 LDKThirtyTwoBytes payment_secret_ref;
6230 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6231 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6232 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6236 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) {
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 LDKThirtyTwoBytes payment_preimage_ref;
6241 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6242 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6243 LDKThirtyTwoBytes payment_secret_ref;
6244 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6245 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6246 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6250 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6251 LDKChannelManager this_arg_conv;
6252 this_arg_conv.inner = (void*)(this_arg & (~1));
6253 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6254 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6255 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6259 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) {
6260 LDKChannelManager this_arg_conv;
6261 this_arg_conv.inner = (void*)(this_arg & (~1));
6262 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6263 LDKOutPoint funding_txo_conv;
6264 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6265 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6266 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6269 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6270 LDKChannelManager this_arg_conv;
6271 this_arg_conv.inner = (void*)(this_arg & (~1));
6272 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6273 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6274 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6278 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6279 LDKChannelManager this_arg_conv;
6280 this_arg_conv.inner = (void*)(this_arg & (~1));
6281 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6282 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6283 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6288 LDKChannelManager this_arg_conv;
6289 this_arg_conv.inner = (void*)(this_arg & (~1));
6290 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6291 unsigned char header_arr[80];
6292 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6293 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6294 unsigned char (*header_ref)[80] = &header_arr;
6295 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6296 FREE((void*)txdata);
6297 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
6301 LDKChannelManager this_arg_conv;
6302 this_arg_conv.inner = (void*)(this_arg & (~1));
6303 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6304 unsigned char header_arr[80];
6305 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6306 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6307 unsigned char (*header_ref)[80] = &header_arr;
6308 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6311 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6312 LDKChannelManager this_arg_conv;
6313 this_arg_conv.inner = (void*)(this_arg & (~1));
6314 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6315 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6316 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6320 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6321 LDKChannelManagerReadArgs this_ptr_conv;
6322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6324 ChannelManagerReadArgs_free(this_ptr_conv);
6327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6328 LDKChannelManagerReadArgs this_ptr_conv;
6329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6331 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6336 LDKChannelManagerReadArgs this_ptr_conv;
6337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6339 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6340 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6341 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6342 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6344 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6347 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6348 LDKChannelManagerReadArgs this_ptr_conv;
6349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6351 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6356 LDKChannelManagerReadArgs this_ptr_conv;
6357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6359 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6360 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6361 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6362 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6364 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6368 LDKChannelManagerReadArgs this_ptr_conv;
6369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6371 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6376 LDKChannelManagerReadArgs this_ptr_conv;
6377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6379 LDKWatch val_conv = *(LDKWatch*)val;
6380 if (val_conv.free == LDKWatch_JCalls_free) {
6381 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6382 LDKWatch_JCalls_clone(val_conv.this_arg);
6384 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6387 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6388 LDKChannelManagerReadArgs this_ptr_conv;
6389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6391 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6396 LDKChannelManagerReadArgs this_ptr_conv;
6397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6399 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6400 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6401 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6402 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6404 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6408 LDKChannelManagerReadArgs this_ptr_conv;
6409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6411 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6416 LDKChannelManagerReadArgs this_ptr_conv;
6417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6419 LDKLogger val_conv = *(LDKLogger*)val;
6420 if (val_conv.free == LDKLogger_JCalls_free) {
6421 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6422 LDKLogger_JCalls_clone(val_conv.this_arg);
6424 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6428 LDKChannelManagerReadArgs this_ptr_conv;
6429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6431 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6432 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6436 LDKChannelManagerReadArgs this_ptr_conv;
6437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6439 LDKUserConfig val_conv;
6440 val_conv.inner = (void*)(val & (~1));
6441 val_conv.is_owned = (val & 1) || (val == 0);
6442 if (val_conv.inner != NULL)
6443 val_conv = UserConfig_clone(&val_conv);
6444 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6447 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) {
6448 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6449 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6450 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6451 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6453 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6454 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6455 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6456 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6458 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6459 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6460 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6461 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6463 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6464 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6465 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6466 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6468 LDKLogger logger_conv = *(LDKLogger*)logger;
6469 if (logger_conv.free == LDKLogger_JCalls_free) {
6470 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6471 LDKLogger_JCalls_clone(logger_conv.this_arg);
6473 LDKUserConfig default_config_conv;
6474 default_config_conv.inner = (void*)(default_config & (~1));
6475 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6476 if (default_config_conv.inner != NULL)
6477 default_config_conv = UserConfig_clone(&default_config_conv);
6478 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6479 FREE((void*)channel_monitors);
6480 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6481 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6485 LDKDecodeError this_ptr_conv;
6486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6488 DecodeError_free(this_ptr_conv);
6491 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6492 LDKInit this_ptr_conv;
6493 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6494 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6495 Init_free(this_ptr_conv);
6498 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6500 orig_conv.inner = (void*)(orig & (~1));
6501 orig_conv.is_owned = (orig & 1) || (orig == 0);
6502 LDKInit ret = Init_clone(&orig_conv);
6503 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6506 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6507 LDKErrorMessage this_ptr_conv;
6508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6510 ErrorMessage_free(this_ptr_conv);
6513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6514 LDKErrorMessage orig_conv;
6515 orig_conv.inner = (void*)(orig & (~1));
6516 orig_conv.is_owned = (orig & 1) || (orig == 0);
6517 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6518 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6522 LDKErrorMessage this_ptr_conv;
6523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6525 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6526 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6531 LDKErrorMessage this_ptr_conv;
6532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6534 LDKThirtyTwoBytes val_ref;
6535 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6536 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6537 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6541 LDKErrorMessage this_ptr_conv;
6542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6544 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6545 *ret = ErrorMessage_get_data(&this_ptr_conv);
6549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6550 LDKErrorMessage this_ptr_conv;
6551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6553 LDKCVec_u8Z val_ref;
6554 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
6555 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
6556 ErrorMessage_set_data(&this_ptr_conv, val_ref);
6557 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
6560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
6561 LDKThirtyTwoBytes channel_id_arg_ref;
6562 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
6563 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6564 LDKCVec_u8Z data_arg_ref;
6565 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
6566 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
6567 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
6568 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
6569 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6572 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6573 LDKPing this_ptr_conv;
6574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6576 Ping_free(this_ptr_conv);
6579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6581 orig_conv.inner = (void*)(orig & (~1));
6582 orig_conv.is_owned = (orig & 1) || (orig == 0);
6583 LDKPing ret = Ping_clone(&orig_conv);
6584 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6587 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6588 LDKPing this_ptr_conv;
6589 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6590 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6591 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
6595 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6596 LDKPing 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 Ping_set_ponglen(&this_ptr_conv, val);
6602 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6603 LDKPing this_ptr_conv;
6604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6606 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
6610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6611 LDKPing 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 Ping_set_byteslen(&this_ptr_conv, val);
6617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6618 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6619 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6623 LDKPong this_ptr_conv;
6624 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6625 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6626 Pong_free(this_ptr_conv);
6629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6631 orig_conv.inner = (void*)(orig & (~1));
6632 orig_conv.is_owned = (orig & 1) || (orig == 0);
6633 LDKPong ret = Pong_clone(&orig_conv);
6634 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6637 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6638 LDKPong this_ptr_conv;
6639 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6640 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6641 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
6645 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6646 LDKPong 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 Pong_set_byteslen(&this_ptr_conv, val);
6652 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6653 LDKPong ret = Pong_new(byteslen_arg);
6654 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6657 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6658 LDKOpenChannel this_ptr_conv;
6659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6661 OpenChannel_free(this_ptr_conv);
6664 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6665 LDKOpenChannel orig_conv;
6666 orig_conv.inner = (void*)(orig & (~1));
6667 orig_conv.is_owned = (orig & 1) || (orig == 0);
6668 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6669 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6672 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6673 LDKOpenChannel this_ptr_conv;
6674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6676 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6677 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6682 LDKOpenChannel this_ptr_conv;
6683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6685 LDKThirtyTwoBytes val_ref;
6686 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6687 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6688 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6691 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6696 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6701 LDKOpenChannel this_ptr_conv;
6702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6704 LDKThirtyTwoBytes val_ref;
6705 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6706 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6707 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6711 LDKOpenChannel this_ptr_conv;
6712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6714 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
6718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6719 LDKOpenChannel this_ptr_conv;
6720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6722 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6725 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6726 LDKOpenChannel this_ptr_conv;
6727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6729 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
6733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6734 LDKOpenChannel this_ptr_conv;
6735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6737 OpenChannel_set_push_msat(&this_ptr_conv, val);
6740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6741 LDKOpenChannel this_ptr_conv;
6742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6744 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6749 LDKOpenChannel this_ptr_conv;
6750 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6751 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6752 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6756 LDKOpenChannel this_ptr_conv;
6757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6759 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6763 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) {
6764 LDKOpenChannel this_ptr_conv;
6765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6767 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6771 LDKOpenChannel this_ptr_conv;
6772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6774 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6778 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6779 LDKOpenChannel this_ptr_conv;
6780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6782 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6785 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6786 LDKOpenChannel this_ptr_conv;
6787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6789 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6793 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6794 LDKOpenChannel this_ptr_conv;
6795 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6796 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6797 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6800 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6801 LDKOpenChannel this_ptr_conv;
6802 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6803 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6804 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6808 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6809 LDKOpenChannel this_ptr_conv;
6810 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6811 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6812 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
6815 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6816 LDKOpenChannel this_ptr_conv;
6817 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6818 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6819 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
6823 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6824 LDKOpenChannel this_ptr_conv;
6825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6827 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
6830 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
6831 LDKOpenChannel this_ptr_conv;
6832 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6833 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6834 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6838 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6839 LDKOpenChannel this_ptr_conv;
6840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6842 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
6845 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6846 LDKOpenChannel this_ptr_conv;
6847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6849 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6850 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6855 LDKOpenChannel this_ptr_conv;
6856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6858 LDKPublicKey val_ref;
6859 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6860 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6861 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6865 LDKOpenChannel this_ptr_conv;
6866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6868 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6869 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6874 LDKOpenChannel this_ptr_conv;
6875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6877 LDKPublicKey val_ref;
6878 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6879 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6880 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6883 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6884 LDKOpenChannel this_ptr_conv;
6885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6887 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6888 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6893 LDKOpenChannel this_ptr_conv;
6894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6896 LDKPublicKey val_ref;
6897 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6898 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6899 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6902 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6903 LDKOpenChannel this_ptr_conv;
6904 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6905 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6906 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6907 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6912 LDKOpenChannel this_ptr_conv;
6913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6915 LDKPublicKey val_ref;
6916 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6917 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6918 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6921 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6922 LDKOpenChannel this_ptr_conv;
6923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6925 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6926 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6931 LDKOpenChannel this_ptr_conv;
6932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6934 LDKPublicKey val_ref;
6935 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6936 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6937 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6940 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6945 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6950 LDKOpenChannel this_ptr_conv;
6951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6953 LDKPublicKey val_ref;
6954 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6955 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6956 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6959 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6960 LDKOpenChannel this_ptr_conv;
6961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6963 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
6967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6968 LDKOpenChannel this_ptr_conv;
6969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6971 OpenChannel_set_channel_flags(&this_ptr_conv, val);
6974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6975 LDKAcceptChannel this_ptr_conv;
6976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6978 AcceptChannel_free(this_ptr_conv);
6981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6982 LDKAcceptChannel orig_conv;
6983 orig_conv.inner = (void*)(orig & (~1));
6984 orig_conv.is_owned = (orig & 1) || (orig == 0);
6985 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6986 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6989 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6994 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6999 LDKAcceptChannel this_ptr_conv;
7000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7002 LDKThirtyTwoBytes val_ref;
7003 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7004 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7005 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7009 LDKAcceptChannel this_ptr_conv;
7010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7012 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7017 LDKAcceptChannel this_ptr_conv;
7018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7020 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7024 LDKAcceptChannel this_ptr_conv;
7025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7027 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7031 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) {
7032 LDKAcceptChannel this_ptr_conv;
7033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7035 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7039 LDKAcceptChannel this_ptr_conv;
7040 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7041 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7042 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7047 LDKAcceptChannel this_ptr_conv;
7048 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7049 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7050 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7054 LDKAcceptChannel this_ptr_conv;
7055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7057 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7061 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7062 LDKAcceptChannel this_ptr_conv;
7063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7065 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7068 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7069 LDKAcceptChannel this_ptr_conv;
7070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7072 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7077 LDKAcceptChannel this_ptr_conv;
7078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7080 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7083 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7084 LDKAcceptChannel this_ptr_conv;
7085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7087 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7092 LDKAcceptChannel this_ptr_conv;
7093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7095 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7098 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7099 LDKAcceptChannel this_ptr_conv;
7100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7102 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7107 LDKAcceptChannel this_ptr_conv;
7108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7110 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7113 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7114 LDKAcceptChannel this_ptr_conv;
7115 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7116 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7117 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7118 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7123 LDKAcceptChannel this_ptr_conv;
7124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7126 LDKPublicKey val_ref;
7127 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7128 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7129 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7132 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7133 LDKAcceptChannel this_ptr_conv;
7134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7136 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7137 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7141 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7142 LDKAcceptChannel this_ptr_conv;
7143 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7144 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7145 LDKPublicKey val_ref;
7146 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7147 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7148 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7151 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7152 LDKAcceptChannel this_ptr_conv;
7153 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7154 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7155 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7156 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7161 LDKAcceptChannel this_ptr_conv;
7162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7164 LDKPublicKey val_ref;
7165 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7166 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7167 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7170 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7171 LDKAcceptChannel this_ptr_conv;
7172 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7173 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7174 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7175 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7180 LDKAcceptChannel this_ptr_conv;
7181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7183 LDKPublicKey val_ref;
7184 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7185 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7186 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7189 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7190 LDKAcceptChannel this_ptr_conv;
7191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7193 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7194 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7199 LDKAcceptChannel this_ptr_conv;
7200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7202 LDKPublicKey val_ref;
7203 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7204 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7205 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7208 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7209 LDKAcceptChannel this_ptr_conv;
7210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7212 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7213 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7217 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7218 LDKAcceptChannel this_ptr_conv;
7219 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7220 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7221 LDKPublicKey val_ref;
7222 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7223 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7224 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7227 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7228 LDKFundingCreated this_ptr_conv;
7229 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7230 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7231 FundingCreated_free(this_ptr_conv);
7234 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7235 LDKFundingCreated orig_conv;
7236 orig_conv.inner = (void*)(orig & (~1));
7237 orig_conv.is_owned = (orig & 1) || (orig == 0);
7238 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7239 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7242 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7243 LDKFundingCreated this_ptr_conv;
7244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7246 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7247 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7252 LDKFundingCreated this_ptr_conv;
7253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7255 LDKThirtyTwoBytes val_ref;
7256 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7257 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7258 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7261 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7266 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7270 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7271 LDKFundingCreated this_ptr_conv;
7272 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7273 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7274 LDKThirtyTwoBytes val_ref;
7275 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7276 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7277 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7280 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7281 LDKFundingCreated this_ptr_conv;
7282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7284 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7289 LDKFundingCreated this_ptr_conv;
7290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7292 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7295 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7296 LDKFundingCreated this_ptr_conv;
7297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7299 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7300 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7305 LDKFundingCreated this_ptr_conv;
7306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7308 LDKSignature val_ref;
7309 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7310 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7311 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7314 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) {
7315 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7316 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7317 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7318 LDKThirtyTwoBytes funding_txid_arg_ref;
7319 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7320 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7321 LDKSignature signature_arg_ref;
7322 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7323 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7324 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7325 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7329 LDKFundingSigned this_ptr_conv;
7330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7332 FundingSigned_free(this_ptr_conv);
7335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7336 LDKFundingSigned orig_conv;
7337 orig_conv.inner = (void*)(orig & (~1));
7338 orig_conv.is_owned = (orig & 1) || (orig == 0);
7339 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7340 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7343 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7344 LDKFundingSigned this_ptr_conv;
7345 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7346 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7347 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7348 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7353 LDKFundingSigned this_ptr_conv;
7354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7356 LDKThirtyTwoBytes val_ref;
7357 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7358 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7359 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7362 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7363 LDKFundingSigned this_ptr_conv;
7364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7366 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7367 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
7371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7372 LDKFundingSigned this_ptr_conv;
7373 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7374 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7375 LDKSignature val_ref;
7376 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7377 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7378 FundingSigned_set_signature(&this_ptr_conv, val_ref);
7381 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
7382 LDKThirtyTwoBytes channel_id_arg_ref;
7383 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7384 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7385 LDKSignature signature_arg_ref;
7386 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7387 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7388 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
7389 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7393 LDKFundingLocked this_ptr_conv;
7394 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7395 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7396 FundingLocked_free(this_ptr_conv);
7399 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7400 LDKFundingLocked orig_conv;
7401 orig_conv.inner = (void*)(orig & (~1));
7402 orig_conv.is_owned = (orig & 1) || (orig == 0);
7403 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7404 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7407 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7408 LDKFundingLocked this_ptr_conv;
7409 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7410 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7411 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7412 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7417 LDKFundingLocked this_ptr_conv;
7418 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7419 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7420 LDKThirtyTwoBytes val_ref;
7421 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7422 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7423 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7426 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7427 LDKFundingLocked this_ptr_conv;
7428 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7429 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7430 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7431 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7436 LDKFundingLocked this_ptr_conv;
7437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7439 LDKPublicKey val_ref;
7440 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7441 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7442 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7445 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7446 LDKThirtyTwoBytes channel_id_arg_ref;
7447 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7448 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7449 LDKPublicKey next_per_commitment_point_arg_ref;
7450 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7451 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7452 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7457 LDKShutdown this_ptr_conv;
7458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7460 Shutdown_free(this_ptr_conv);
7463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7464 LDKShutdown orig_conv;
7465 orig_conv.inner = (void*)(orig & (~1));
7466 orig_conv.is_owned = (orig & 1) || (orig == 0);
7467 LDKShutdown ret = Shutdown_clone(&orig_conv);
7468 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7471 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7472 LDKShutdown this_ptr_conv;
7473 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7474 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7475 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7476 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7481 LDKShutdown this_ptr_conv;
7482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7484 LDKThirtyTwoBytes val_ref;
7485 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7486 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7487 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7490 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7491 LDKShutdown this_ptr_conv;
7492 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7493 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7494 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
7495 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7496 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7501 LDKShutdown this_ptr_conv;
7502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7504 LDKCVec_u8Z val_ref;
7505 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7506 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7507 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
7508 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7511 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
7512 LDKThirtyTwoBytes channel_id_arg_ref;
7513 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7514 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7515 LDKCVec_u8Z scriptpubkey_arg_ref;
7516 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
7517 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
7518 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
7519 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
7520 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7524 LDKClosingSigned this_ptr_conv;
7525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7527 ClosingSigned_free(this_ptr_conv);
7530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7531 LDKClosingSigned orig_conv;
7532 orig_conv.inner = (void*)(orig & (~1));
7533 orig_conv.is_owned = (orig & 1) || (orig == 0);
7534 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7535 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7538 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7539 LDKClosingSigned this_ptr_conv;
7540 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7541 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7542 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7543 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7548 LDKClosingSigned this_ptr_conv;
7549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7551 LDKThirtyTwoBytes val_ref;
7552 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7553 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7554 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7558 LDKClosingSigned this_ptr_conv;
7559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7561 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7566 LDKClosingSigned this_ptr_conv;
7567 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7568 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7569 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7573 LDKClosingSigned this_ptr_conv;
7574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7576 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7577 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
7581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7582 LDKClosingSigned this_ptr_conv;
7583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7585 LDKSignature val_ref;
7586 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7587 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7588 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
7591 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) {
7592 LDKThirtyTwoBytes channel_id_arg_ref;
7593 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7594 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7595 LDKSignature signature_arg_ref;
7596 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7597 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7598 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
7599 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7603 LDKUpdateAddHTLC this_ptr_conv;
7604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7606 UpdateAddHTLC_free(this_ptr_conv);
7609 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7610 LDKUpdateAddHTLC orig_conv;
7611 orig_conv.inner = (void*)(orig & (~1));
7612 orig_conv.is_owned = (orig & 1) || (orig == 0);
7613 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7614 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7617 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7618 LDKUpdateAddHTLC this_ptr_conv;
7619 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7620 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7621 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7622 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7626 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7627 LDKUpdateAddHTLC this_ptr_conv;
7628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7630 LDKThirtyTwoBytes val_ref;
7631 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7632 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7633 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7637 LDKUpdateAddHTLC this_ptr_conv;
7638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7640 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong 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 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7652 LDKUpdateAddHTLC this_ptr_conv;
7653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7655 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7660 LDKUpdateAddHTLC this_ptr_conv;
7661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7663 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7666 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7667 LDKUpdateAddHTLC this_ptr_conv;
7668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7670 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7671 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7676 LDKUpdateAddHTLC this_ptr_conv;
7677 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7678 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7679 LDKThirtyTwoBytes val_ref;
7680 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7681 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7682 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7685 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7686 LDKUpdateAddHTLC this_ptr_conv;
7687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7689 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7694 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7701 LDKUpdateFulfillHTLC this_ptr_conv;
7702 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7703 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7704 UpdateFulfillHTLC_free(this_ptr_conv);
7707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7708 LDKUpdateFulfillHTLC orig_conv;
7709 orig_conv.inner = (void*)(orig & (~1));
7710 orig_conv.is_owned = (orig & 1) || (orig == 0);
7711 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7712 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7715 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7716 LDKUpdateFulfillHTLC this_ptr_conv;
7717 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7718 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7719 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7720 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7725 LDKUpdateFulfillHTLC this_ptr_conv;
7726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7728 LDKThirtyTwoBytes val_ref;
7729 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7730 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7731 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7734 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7735 LDKUpdateFulfillHTLC this_ptr_conv;
7736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7738 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7743 LDKUpdateFulfillHTLC this_ptr_conv;
7744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7746 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7750 LDKUpdateFulfillHTLC this_ptr_conv;
7751 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7752 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7753 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7754 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7759 LDKUpdateFulfillHTLC this_ptr_conv;
7760 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7761 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7762 LDKThirtyTwoBytes val_ref;
7763 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7764 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7765 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7768 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) {
7769 LDKThirtyTwoBytes channel_id_arg_ref;
7770 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7771 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7772 LDKThirtyTwoBytes payment_preimage_arg_ref;
7773 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
7774 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7775 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7776 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7779 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7780 LDKUpdateFailHTLC this_ptr_conv;
7781 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7782 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7783 UpdateFailHTLC_free(this_ptr_conv);
7786 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7787 LDKUpdateFailHTLC orig_conv;
7788 orig_conv.inner = (void*)(orig & (~1));
7789 orig_conv.is_owned = (orig & 1) || (orig == 0);
7790 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7791 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7794 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7795 LDKUpdateFailHTLC this_ptr_conv;
7796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7798 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7799 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7804 LDKUpdateFailHTLC this_ptr_conv;
7805 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7806 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7807 LDKThirtyTwoBytes val_ref;
7808 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7809 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7810 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7814 LDKUpdateFailHTLC this_ptr_conv;
7815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7817 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7822 LDKUpdateFailHTLC 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 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7829 LDKUpdateFailMalformedHTLC this_ptr_conv;
7830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7832 UpdateFailMalformedHTLC_free(this_ptr_conv);
7835 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7836 LDKUpdateFailMalformedHTLC orig_conv;
7837 orig_conv.inner = (void*)(orig & (~1));
7838 orig_conv.is_owned = (orig & 1) || (orig == 0);
7839 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7840 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7843 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7844 LDKUpdateFailMalformedHTLC this_ptr_conv;
7845 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7846 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7847 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7848 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7852 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7853 LDKUpdateFailMalformedHTLC this_ptr_conv;
7854 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7855 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7856 LDKThirtyTwoBytes val_ref;
7857 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7858 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7859 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7863 LDKUpdateFailMalformedHTLC this_ptr_conv;
7864 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7865 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7866 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7870 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7871 LDKUpdateFailMalformedHTLC this_ptr_conv;
7872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7874 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7877 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7878 LDKUpdateFailMalformedHTLC this_ptr_conv;
7879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7881 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7886 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7893 LDKCommitmentSigned this_ptr_conv;
7894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7896 CommitmentSigned_free(this_ptr_conv);
7899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7900 LDKCommitmentSigned orig_conv;
7901 orig_conv.inner = (void*)(orig & (~1));
7902 orig_conv.is_owned = (orig & 1) || (orig == 0);
7903 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7904 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7907 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7908 LDKCommitmentSigned this_ptr_conv;
7909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7911 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7912 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7917 LDKCommitmentSigned this_ptr_conv;
7918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7919 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7920 LDKThirtyTwoBytes val_ref;
7921 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7922 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7923 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7927 LDKCommitmentSigned this_ptr_conv;
7928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7930 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7931 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
7935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7936 LDKCommitmentSigned this_ptr_conv;
7937 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7938 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7939 LDKSignature val_ref;
7940 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7941 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7942 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
7945 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7946 LDKCommitmentSigned this_ptr_conv;
7947 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7948 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7949 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7951 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7954 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) {
7955 LDKThirtyTwoBytes channel_id_arg_ref;
7956 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7957 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7958 LDKSignature signature_arg_ref;
7959 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7960 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7961 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7962 FREE((void*)htlc_signatures_arg);
7963 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_conv);
7964 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7968 LDKRevokeAndACK this_ptr_conv;
7969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7971 RevokeAndACK_free(this_ptr_conv);
7974 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7975 LDKRevokeAndACK orig_conv;
7976 orig_conv.inner = (void*)(orig & (~1));
7977 orig_conv.is_owned = (orig & 1) || (orig == 0);
7978 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7979 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7982 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7983 LDKRevokeAndACK this_ptr_conv;
7984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7986 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7987 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7992 LDKRevokeAndACK this_ptr_conv;
7993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7995 LDKThirtyTwoBytes val_ref;
7996 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7997 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7998 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8001 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8002 LDKRevokeAndACK this_ptr_conv;
8003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8005 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8006 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8011 LDKRevokeAndACK this_ptr_conv;
8012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8014 LDKThirtyTwoBytes val_ref;
8015 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8016 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8017 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8020 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8021 LDKRevokeAndACK this_ptr_conv;
8022 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8023 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8024 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8025 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8029 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8030 LDKRevokeAndACK this_ptr_conv;
8031 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8032 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8033 LDKPublicKey val_ref;
8034 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8035 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8036 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8039 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) {
8040 LDKThirtyTwoBytes channel_id_arg_ref;
8041 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8042 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8043 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8044 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8045 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8046 LDKPublicKey next_per_commitment_point_arg_ref;
8047 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8048 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8049 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8050 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8054 LDKUpdateFee this_ptr_conv;
8055 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8056 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8057 UpdateFee_free(this_ptr_conv);
8060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8061 LDKUpdateFee orig_conv;
8062 orig_conv.inner = (void*)(orig & (~1));
8063 orig_conv.is_owned = (orig & 1) || (orig == 0);
8064 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8065 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8068 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8069 LDKUpdateFee this_ptr_conv;
8070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8072 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8073 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8078 LDKUpdateFee this_ptr_conv;
8079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8081 LDKThirtyTwoBytes val_ref;
8082 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8083 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8084 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8087 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8088 LDKUpdateFee this_ptr_conv;
8089 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8090 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8091 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8095 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8096 LDKUpdateFee this_ptr_conv;
8097 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8098 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8099 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8102 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8103 LDKThirtyTwoBytes channel_id_arg_ref;
8104 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8105 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8106 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8107 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8111 LDKDataLossProtect this_ptr_conv;
8112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8114 DataLossProtect_free(this_ptr_conv);
8117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8118 LDKDataLossProtect orig_conv;
8119 orig_conv.inner = (void*)(orig & (~1));
8120 orig_conv.is_owned = (orig & 1) || (orig == 0);
8121 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8122 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8126 LDKDataLossProtect this_ptr_conv;
8127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8129 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8130 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8135 LDKDataLossProtect this_ptr_conv;
8136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8138 LDKThirtyTwoBytes val_ref;
8139 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8140 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8141 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8144 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8145 LDKDataLossProtect this_ptr_conv;
8146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8148 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8149 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8154 LDKDataLossProtect this_ptr_conv;
8155 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8156 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8157 LDKPublicKey val_ref;
8158 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8159 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8160 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8163 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) {
8164 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8165 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8166 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8167 LDKPublicKey my_current_per_commitment_point_arg_ref;
8168 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8169 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8170 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8171 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8175 LDKChannelReestablish this_ptr_conv;
8176 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8177 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8178 ChannelReestablish_free(this_ptr_conv);
8181 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8182 LDKChannelReestablish orig_conv;
8183 orig_conv.inner = (void*)(orig & (~1));
8184 orig_conv.is_owned = (orig & 1) || (orig == 0);
8185 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8186 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8189 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8190 LDKChannelReestablish this_ptr_conv;
8191 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8192 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8193 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8194 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8199 LDKChannelReestablish this_ptr_conv;
8200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8202 LDKThirtyTwoBytes val_ref;
8203 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8204 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8205 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8209 LDKChannelReestablish this_ptr_conv;
8210 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8211 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8212 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8217 LDKChannelReestablish this_ptr_conv;
8218 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8219 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8220 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8224 LDKChannelReestablish this_ptr_conv;
8225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8226 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8227 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8231 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8232 LDKChannelReestablish 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 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8239 LDKAnnouncementSignatures this_ptr_conv;
8240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8242 AnnouncementSignatures_free(this_ptr_conv);
8245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8246 LDKAnnouncementSignatures orig_conv;
8247 orig_conv.inner = (void*)(orig & (~1));
8248 orig_conv.is_owned = (orig & 1) || (orig == 0);
8249 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8250 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8253 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8254 LDKAnnouncementSignatures this_ptr_conv;
8255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8257 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8258 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8263 LDKAnnouncementSignatures this_ptr_conv;
8264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8266 LDKThirtyTwoBytes val_ref;
8267 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8268 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8269 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8272 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8273 LDKAnnouncementSignatures this_ptr_conv;
8274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8276 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8281 LDKAnnouncementSignatures this_ptr_conv;
8282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8284 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8287 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8288 LDKAnnouncementSignatures this_ptr_conv;
8289 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8290 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8291 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8292 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8297 LDKAnnouncementSignatures this_ptr_conv;
8298 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8299 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8300 LDKSignature val_ref;
8301 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8302 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8303 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8306 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8307 LDKAnnouncementSignatures this_ptr_conv;
8308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8310 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8311 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8315 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8316 LDKAnnouncementSignatures this_ptr_conv;
8317 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8318 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8319 LDKSignature val_ref;
8320 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8321 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8322 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8325 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) {
8326 LDKThirtyTwoBytes channel_id_arg_ref;
8327 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8328 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8329 LDKSignature node_signature_arg_ref;
8330 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8331 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8332 LDKSignature bitcoin_signature_arg_ref;
8333 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8334 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8335 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8336 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8340 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8341 FREE((void*)this_ptr);
8342 NetAddress_free(this_ptr_conv);
8345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8346 LDKUnsignedNodeAnnouncement this_ptr_conv;
8347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8349 UnsignedNodeAnnouncement_free(this_ptr_conv);
8352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8353 LDKUnsignedNodeAnnouncement orig_conv;
8354 orig_conv.inner = (void*)(orig & (~1));
8355 orig_conv.is_owned = (orig & 1) || (orig == 0);
8356 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
8357 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8360 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8361 LDKUnsignedNodeAnnouncement this_ptr_conv;
8362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8364 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8365 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8369 LDKUnsignedNodeAnnouncement this_ptr_conv;
8370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8372 LDKNodeFeatures val_conv;
8373 val_conv.inner = (void*)(val & (~1));
8374 val_conv.is_owned = (val & 1) || (val == 0);
8375 // Warning: we may need a move here but can't clone!
8376 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8379 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8380 LDKUnsignedNodeAnnouncement this_ptr_conv;
8381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8383 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8388 LDKUnsignedNodeAnnouncement this_ptr_conv;
8389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8391 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8394 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8395 LDKUnsignedNodeAnnouncement this_ptr_conv;
8396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8398 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8399 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8403 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8404 LDKUnsignedNodeAnnouncement this_ptr_conv;
8405 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8406 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8407 LDKPublicKey val_ref;
8408 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8409 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8410 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8413 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8414 LDKUnsignedNodeAnnouncement this_ptr_conv;
8415 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8416 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8417 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8418 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8422 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8423 LDKUnsignedNodeAnnouncement this_ptr_conv;
8424 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8425 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8426 LDKThreeBytes val_ref;
8427 CHECK((*_env)->GetArrayLength (_env, val) == 3);
8428 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
8429 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
8432 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8433 LDKUnsignedNodeAnnouncement this_ptr_conv;
8434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8436 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8437 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8442 LDKUnsignedNodeAnnouncement this_ptr_conv;
8443 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8444 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8445 LDKThirtyTwoBytes val_ref;
8446 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8447 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8448 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8451 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8452 LDKUnsignedNodeAnnouncement this_ptr_conv;
8453 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8454 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8455 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8457 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8461 LDKNodeAnnouncement this_ptr_conv;
8462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8464 NodeAnnouncement_free(this_ptr_conv);
8467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8468 LDKNodeAnnouncement orig_conv;
8469 orig_conv.inner = (void*)(orig & (~1));
8470 orig_conv.is_owned = (orig & 1) || (orig == 0);
8471 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8472 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8475 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8476 LDKNodeAnnouncement this_ptr_conv;
8477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8479 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8480 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
8484 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8485 LDKNodeAnnouncement this_ptr_conv;
8486 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8487 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8488 LDKSignature val_ref;
8489 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8490 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8491 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
8494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8495 LDKNodeAnnouncement this_ptr_conv;
8496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8498 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8499 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8503 LDKNodeAnnouncement this_ptr_conv;
8504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8506 LDKUnsignedNodeAnnouncement val_conv;
8507 val_conv.inner = (void*)(val & (~1));
8508 val_conv.is_owned = (val & 1) || (val == 0);
8509 if (val_conv.inner != NULL)
8510 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8511 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8514 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8515 LDKSignature signature_arg_ref;
8516 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8517 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8518 LDKUnsignedNodeAnnouncement contents_arg_conv;
8519 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8520 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8521 if (contents_arg_conv.inner != NULL)
8522 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8523 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
8524 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8528 LDKUnsignedChannelAnnouncement this_ptr_conv;
8529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8531 UnsignedChannelAnnouncement_free(this_ptr_conv);
8534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8535 LDKUnsignedChannelAnnouncement orig_conv;
8536 orig_conv.inner = (void*)(orig & (~1));
8537 orig_conv.is_owned = (orig & 1) || (orig == 0);
8538 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8539 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8543 LDKUnsignedChannelAnnouncement this_ptr_conv;
8544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8546 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8547 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8551 LDKUnsignedChannelAnnouncement this_ptr_conv;
8552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8554 LDKChannelFeatures val_conv;
8555 val_conv.inner = (void*)(val & (~1));
8556 val_conv.is_owned = (val & 1) || (val == 0);
8557 // Warning: we may need a move here but can't clone!
8558 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8561 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8562 LDKUnsignedChannelAnnouncement this_ptr_conv;
8563 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8564 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8565 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8566 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8571 LDKUnsignedChannelAnnouncement this_ptr_conv;
8572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8574 LDKThirtyTwoBytes val_ref;
8575 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8576 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8577 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8581 LDKUnsignedChannelAnnouncement this_ptr_conv;
8582 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8583 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8584 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8589 LDKUnsignedChannelAnnouncement this_ptr_conv;
8590 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8591 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8592 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8596 LDKUnsignedChannelAnnouncement this_ptr_conv;
8597 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8598 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8605 LDKUnsignedChannelAnnouncement this_ptr_conv;
8606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8608 LDKPublicKey val_ref;
8609 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8610 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8611 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8614 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8615 LDKUnsignedChannelAnnouncement this_ptr_conv;
8616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8623 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8624 LDKUnsignedChannelAnnouncement this_ptr_conv;
8625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8627 LDKPublicKey val_ref;
8628 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8629 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8630 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8633 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8634 LDKUnsignedChannelAnnouncement this_ptr_conv;
8635 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8636 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8637 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8638 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8642 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8643 LDKUnsignedChannelAnnouncement this_ptr_conv;
8644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8646 LDKPublicKey val_ref;
8647 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8648 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8649 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8652 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8653 LDKUnsignedChannelAnnouncement this_ptr_conv;
8654 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8655 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8656 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8657 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8661 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8662 LDKUnsignedChannelAnnouncement this_ptr_conv;
8663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8665 LDKPublicKey val_ref;
8666 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8667 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8668 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8671 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8672 LDKChannelAnnouncement this_ptr_conv;
8673 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8674 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8675 ChannelAnnouncement_free(this_ptr_conv);
8678 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8679 LDKChannelAnnouncement orig_conv;
8680 orig_conv.inner = (void*)(orig & (~1));
8681 orig_conv.is_owned = (orig & 1) || (orig == 0);
8682 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8683 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8686 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8687 LDKChannelAnnouncement this_ptr_conv;
8688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8690 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8691 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
8695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8696 LDKChannelAnnouncement this_ptr_conv;
8697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8699 LDKSignature val_ref;
8700 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8701 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8702 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
8705 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8706 LDKChannelAnnouncement this_ptr_conv;
8707 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8708 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8709 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8710 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
8714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8715 LDKChannelAnnouncement this_ptr_conv;
8716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8718 LDKSignature val_ref;
8719 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8720 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8721 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
8724 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8725 LDKChannelAnnouncement this_ptr_conv;
8726 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8727 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8728 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8729 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
8733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8734 LDKChannelAnnouncement this_ptr_conv;
8735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8737 LDKSignature val_ref;
8738 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8739 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8740 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
8743 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8744 LDKChannelAnnouncement this_ptr_conv;
8745 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8746 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8747 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8748 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
8752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8753 LDKChannelAnnouncement this_ptr_conv;
8754 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8755 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8756 LDKSignature val_ref;
8757 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8758 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8759 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
8762 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8763 LDKChannelAnnouncement this_ptr_conv;
8764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8766 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8767 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8771 LDKChannelAnnouncement this_ptr_conv;
8772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8774 LDKUnsignedChannelAnnouncement val_conv;
8775 val_conv.inner = (void*)(val & (~1));
8776 val_conv.is_owned = (val & 1) || (val == 0);
8777 if (val_conv.inner != NULL)
8778 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8779 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8782 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) {
8783 LDKSignature node_signature_1_arg_ref;
8784 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
8785 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
8786 LDKSignature node_signature_2_arg_ref;
8787 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
8788 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
8789 LDKSignature bitcoin_signature_1_arg_ref;
8790 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
8791 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
8792 LDKSignature bitcoin_signature_2_arg_ref;
8793 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
8794 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
8795 LDKUnsignedChannelAnnouncement contents_arg_conv;
8796 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8797 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8798 if (contents_arg_conv.inner != NULL)
8799 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8800 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);
8801 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8805 LDKUnsignedChannelUpdate this_ptr_conv;
8806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8808 UnsignedChannelUpdate_free(this_ptr_conv);
8811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8812 LDKUnsignedChannelUpdate orig_conv;
8813 orig_conv.inner = (void*)(orig & (~1));
8814 orig_conv.is_owned = (orig & 1) || (orig == 0);
8815 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8816 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8819 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8820 LDKUnsignedChannelUpdate this_ptr_conv;
8821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8823 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8824 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8829 LDKUnsignedChannelUpdate this_ptr_conv;
8830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8832 LDKThirtyTwoBytes val_ref;
8833 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8834 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8835 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8839 LDKUnsignedChannelUpdate this_ptr_conv;
8840 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8841 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8842 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8846 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8847 LDKUnsignedChannelUpdate this_ptr_conv;
8848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8850 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8853 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8854 LDKUnsignedChannelUpdate this_ptr_conv;
8855 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8856 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8857 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8861 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8862 LDKUnsignedChannelUpdate this_ptr_conv;
8863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8865 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8868 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8869 LDKUnsignedChannelUpdate this_ptr_conv;
8870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8872 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8876 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8877 LDKUnsignedChannelUpdate this_ptr_conv;
8878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8880 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8883 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8884 LDKUnsignedChannelUpdate this_ptr_conv;
8885 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8886 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8887 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8892 LDKUnsignedChannelUpdate this_ptr_conv;
8893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8895 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8898 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8899 LDKUnsignedChannelUpdate this_ptr_conv;
8900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8902 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8906 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8907 LDKUnsignedChannelUpdate this_ptr_conv;
8908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8910 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8913 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8914 LDKUnsignedChannelUpdate this_ptr_conv;
8915 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8916 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8917 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8922 LDKUnsignedChannelUpdate this_ptr_conv;
8923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8925 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8928 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8929 LDKUnsignedChannelUpdate this_ptr_conv;
8930 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8931 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8932 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8937 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8943 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8944 LDKChannelUpdate this_ptr_conv;
8945 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8946 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8947 ChannelUpdate_free(this_ptr_conv);
8950 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8951 LDKChannelUpdate orig_conv;
8952 orig_conv.inner = (void*)(orig & (~1));
8953 orig_conv.is_owned = (orig & 1) || (orig == 0);
8954 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8955 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8958 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8959 LDKChannelUpdate this_ptr_conv;
8960 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8961 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8962 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8963 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
8967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8968 LDKChannelUpdate this_ptr_conv;
8969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8971 LDKSignature val_ref;
8972 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8973 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8974 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
8977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8978 LDKChannelUpdate this_ptr_conv;
8979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8981 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8982 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8985 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8986 LDKChannelUpdate this_ptr_conv;
8987 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8988 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8989 LDKUnsignedChannelUpdate val_conv;
8990 val_conv.inner = (void*)(val & (~1));
8991 val_conv.is_owned = (val & 1) || (val == 0);
8992 if (val_conv.inner != NULL)
8993 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8994 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8997 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8998 LDKSignature signature_arg_ref;
8999 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9000 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9001 LDKUnsignedChannelUpdate contents_arg_conv;
9002 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9003 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9004 if (contents_arg_conv.inner != NULL)
9005 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9006 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9007 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9010 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9011 LDKQueryChannelRange this_ptr_conv;
9012 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9013 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9014 QueryChannelRange_free(this_ptr_conv);
9017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9018 LDKQueryChannelRange orig_conv;
9019 orig_conv.inner = (void*)(orig & (~1));
9020 orig_conv.is_owned = (orig & 1) || (orig == 0);
9021 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9022 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9025 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9026 LDKQueryChannelRange this_ptr_conv;
9027 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9028 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9029 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9030 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9035 LDKQueryChannelRange this_ptr_conv;
9036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9038 LDKThirtyTwoBytes val_ref;
9039 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9040 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9041 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9044 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9045 LDKQueryChannelRange this_ptr_conv;
9046 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9047 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9048 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9053 LDKQueryChannelRange this_ptr_conv;
9054 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9055 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9056 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9059 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9060 LDKQueryChannelRange this_ptr_conv;
9061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9063 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9068 LDKQueryChannelRange this_ptr_conv;
9069 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9070 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9071 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9074 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) {
9075 LDKThirtyTwoBytes chain_hash_arg_ref;
9076 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9077 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9078 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9079 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9083 LDKReplyChannelRange this_ptr_conv;
9084 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9085 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9086 ReplyChannelRange_free(this_ptr_conv);
9089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9090 LDKReplyChannelRange orig_conv;
9091 orig_conv.inner = (void*)(orig & (~1));
9092 orig_conv.is_owned = (orig & 1) || (orig == 0);
9093 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9097 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9098 LDKReplyChannelRange this_ptr_conv;
9099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9101 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9102 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9106 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9107 LDKReplyChannelRange this_ptr_conv;
9108 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9109 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9110 LDKThirtyTwoBytes val_ref;
9111 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9112 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9113 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9116 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9117 LDKReplyChannelRange this_ptr_conv;
9118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9120 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9125 LDKReplyChannelRange this_ptr_conv;
9126 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9127 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9128 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9131 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9132 LDKReplyChannelRange this_ptr_conv;
9133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9135 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9140 LDKReplyChannelRange this_ptr_conv;
9141 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9142 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9143 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9146 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9147 LDKReplyChannelRange this_ptr_conv;
9148 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9149 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9150 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9155 LDKReplyChannelRange this_ptr_conv;
9156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9158 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9162 LDKReplyChannelRange this_ptr_conv;
9163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9165 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9167 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
9170 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) {
9171 LDKThirtyTwoBytes chain_hash_arg_ref;
9172 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9173 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9174 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9175 FREE((void*)short_channel_ids_arg);
9176 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
9177 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9181 LDKQueryShortChannelIds this_ptr_conv;
9182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9184 QueryShortChannelIds_free(this_ptr_conv);
9187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9188 LDKQueryShortChannelIds orig_conv;
9189 orig_conv.inner = (void*)(orig & (~1));
9190 orig_conv.is_owned = (orig & 1) || (orig == 0);
9191 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9192 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9195 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9196 LDKQueryShortChannelIds this_ptr_conv;
9197 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9198 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9199 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9200 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9205 LDKQueryShortChannelIds this_ptr_conv;
9206 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9207 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9208 LDKThirtyTwoBytes val_ref;
9209 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9210 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9211 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9215 LDKQueryShortChannelIds this_ptr_conv;
9216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9218 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9220 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
9223 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
9224 LDKThirtyTwoBytes chain_hash_arg_ref;
9225 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9226 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9227 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9228 FREE((void*)short_channel_ids_arg);
9229 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
9230 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9234 LDKReplyShortChannelIdsEnd this_ptr_conv;
9235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9237 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9241 LDKReplyShortChannelIdsEnd orig_conv;
9242 orig_conv.inner = (void*)(orig & (~1));
9243 orig_conv.is_owned = (orig & 1) || (orig == 0);
9244 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9245 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9248 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9249 LDKReplyShortChannelIdsEnd this_ptr_conv;
9250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9252 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9253 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9257 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9258 LDKReplyShortChannelIdsEnd this_ptr_conv;
9259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9261 LDKThirtyTwoBytes val_ref;
9262 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9263 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9264 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9267 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9268 LDKReplyShortChannelIdsEnd this_ptr_conv;
9269 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9270 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9271 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9275 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9276 LDKReplyShortChannelIdsEnd this_ptr_conv;
9277 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9278 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9279 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9283 LDKThirtyTwoBytes chain_hash_arg_ref;
9284 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9285 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9286 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
9287 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9291 LDKGossipTimestampFilter this_ptr_conv;
9292 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9293 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9294 GossipTimestampFilter_free(this_ptr_conv);
9297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9298 LDKGossipTimestampFilter orig_conv;
9299 orig_conv.inner = (void*)(orig & (~1));
9300 orig_conv.is_owned = (orig & 1) || (orig == 0);
9301 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
9302 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9305 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9306 LDKGossipTimestampFilter this_ptr_conv;
9307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9309 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9310 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
9314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9315 LDKGossipTimestampFilter this_ptr_conv;
9316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9318 LDKThirtyTwoBytes val_ref;
9319 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9320 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9321 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
9324 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9325 LDKGossipTimestampFilter this_ptr_conv;
9326 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9327 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9328 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
9332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9333 LDKGossipTimestampFilter this_ptr_conv;
9334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9336 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
9339 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
9340 LDKGossipTimestampFilter this_ptr_conv;
9341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9343 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
9347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9348 LDKGossipTimestampFilter this_ptr_conv;
9349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9351 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
9354 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) {
9355 LDKThirtyTwoBytes chain_hash_arg_ref;
9356 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9357 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9358 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
9359 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9362 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9363 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
9364 FREE((void*)this_ptr);
9365 ErrorAction_free(this_ptr_conv);
9368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9369 LDKLightningError this_ptr_conv;
9370 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9371 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9372 LightningError_free(this_ptr_conv);
9375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
9376 LDKLightningError this_ptr_conv;
9377 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9378 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9379 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
9380 *ret = LightningError_get_err(&this_ptr_conv);
9384 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9385 LDKLightningError this_ptr_conv;
9386 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9387 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9388 LDKCVec_u8Z val_ref;
9389 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
9390 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
9391 LightningError_set_err(&this_ptr_conv, val_ref);
9392 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
9395 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
9396 LDKLightningError this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9399 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
9400 *ret = LightningError_get_action(&this_ptr_conv);
9404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9405 LDKLightningError 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 LDKErrorAction val_conv = *(LDKErrorAction*)val;
9410 LightningError_set_action(&this_ptr_conv, val_conv);
9413 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
9414 LDKCVec_u8Z err_arg_ref;
9415 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
9416 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
9417 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9418 FREE((void*)action_arg);
9419 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
9420 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
9421 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9425 LDKCommitmentUpdate this_ptr_conv;
9426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9428 CommitmentUpdate_free(this_ptr_conv);
9431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9432 LDKCommitmentUpdate orig_conv;
9433 orig_conv.inner = (void*)(orig & (~1));
9434 orig_conv.is_owned = (orig & 1) || (orig == 0);
9435 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9436 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9440 LDKCommitmentUpdate this_ptr_conv;
9441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9443 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9445 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(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 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9454 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9458 LDKCommitmentUpdate this_ptr_conv;
9459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9461 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9463 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9466 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9467 LDKCommitmentUpdate this_ptr_conv;
9468 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9469 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9470 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9472 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9476 LDKCommitmentUpdate this_ptr_conv;
9477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9479 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9484 LDKCommitmentUpdate this_ptr_conv;
9485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9487 LDKUpdateFee val_conv;
9488 val_conv.inner = (void*)(val & (~1));
9489 val_conv.is_owned = (val & 1) || (val == 0);
9490 if (val_conv.inner != NULL)
9491 val_conv = UpdateFee_clone(&val_conv);
9492 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9495 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9496 LDKCommitmentUpdate this_ptr_conv;
9497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9499 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9500 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9504 LDKCommitmentUpdate this_ptr_conv;
9505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9507 LDKCommitmentSigned val_conv;
9508 val_conv.inner = (void*)(val & (~1));
9509 val_conv.is_owned = (val & 1) || (val == 0);
9510 if (val_conv.inner != NULL)
9511 val_conv = CommitmentSigned_clone(&val_conv);
9512 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9515 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) {
9516 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9517 FREE((void*)update_add_htlcs_arg);
9518 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9519 FREE((void*)update_fulfill_htlcs_arg);
9520 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9521 FREE((void*)update_fail_htlcs_arg);
9522 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9523 FREE((void*)update_fail_malformed_htlcs_arg);
9524 LDKUpdateFee update_fee_arg_conv;
9525 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9526 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9527 if (update_fee_arg_conv.inner != NULL)
9528 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9529 LDKCommitmentSigned commitment_signed_arg_conv;
9530 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9531 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9532 if (commitment_signed_arg_conv.inner != NULL)
9533 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9534 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);
9535 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9538 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9539 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9540 FREE((void*)this_ptr);
9541 HTLCFailChannelUpdate_free(this_ptr_conv);
9544 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9545 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9546 FREE((void*)this_ptr);
9547 ChannelMessageHandler_free(this_ptr_conv);
9550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9551 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9552 FREE((void*)this_ptr);
9553 RoutingMessageHandler_free(this_ptr_conv);
9556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9557 LDKAcceptChannel obj_conv;
9558 obj_conv.inner = (void*)(obj & (~1));
9559 obj_conv.is_owned = (obj & 1) || (obj == 0);
9560 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
9561 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9562 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_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 LDKAcceptChannel ret = AcceptChannel_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 jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9576 LDKAnnouncementSignatures obj_conv;
9577 obj_conv.inner = (void*)(obj & (~1));
9578 obj_conv.is_owned = (obj & 1) || (obj == 0);
9579 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
9580 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9581 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9585 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9587 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9588 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9589 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
9590 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9591 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9594 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9595 LDKChannelReestablish obj_conv;
9596 obj_conv.inner = (void*)(obj & (~1));
9597 obj_conv.is_owned = (obj & 1) || (obj == 0);
9598 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
9599 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9600 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9606 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9607 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9608 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
9609 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9610 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9614 LDKClosingSigned obj_conv;
9615 obj_conv.inner = (void*)(obj & (~1));
9616 obj_conv.is_owned = (obj & 1) || (obj == 0);
9617 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
9618 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9619 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9623 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9625 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9626 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9627 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
9628 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9629 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9633 LDKCommitmentSigned obj_conv;
9634 obj_conv.inner = (void*)(obj & (~1));
9635 obj_conv.is_owned = (obj & 1) || (obj == 0);
9636 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
9637 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9638 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9644 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9645 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9646 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
9647 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9648 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9651 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9652 LDKFundingCreated obj_conv;
9653 obj_conv.inner = (void*)(obj & (~1));
9654 obj_conv.is_owned = (obj & 1) || (obj == 0);
9655 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
9656 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9657 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9663 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9664 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9665 LDKFundingCreated ret = FundingCreated_read(ser_ref);
9666 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9667 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9671 LDKFundingSigned obj_conv;
9672 obj_conv.inner = (void*)(obj & (~1));
9673 obj_conv.is_owned = (obj & 1) || (obj == 0);
9674 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
9675 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9676 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9682 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9683 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9684 LDKFundingSigned ret = FundingSigned_read(ser_ref);
9685 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9686 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9690 LDKFundingLocked obj_conv;
9691 obj_conv.inner = (void*)(obj & (~1));
9692 obj_conv.is_owned = (obj & 1) || (obj == 0);
9693 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
9694 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9695 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9699 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9701 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9702 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9703 LDKFundingLocked ret = FundingLocked_read(ser_ref);
9704 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9710 obj_conv.inner = (void*)(obj & (~1));
9711 obj_conv.is_owned = (obj & 1) || (obj == 0);
9712 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
9713 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9714 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9718 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9720 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9721 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9722 LDKInit ret = Init_read(ser_ref);
9723 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9724 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9727 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9728 LDKOpenChannel obj_conv;
9729 obj_conv.inner = (void*)(obj & (~1));
9730 obj_conv.is_owned = (obj & 1) || (obj == 0);
9731 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
9732 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9733 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9739 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9740 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9741 LDKOpenChannel ret = OpenChannel_read(ser_ref);
9742 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9743 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9746 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9747 LDKRevokeAndACK obj_conv;
9748 obj_conv.inner = (void*)(obj & (~1));
9749 obj_conv.is_owned = (obj & 1) || (obj == 0);
9750 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
9751 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9752 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9758 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9759 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9760 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
9761 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9762 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9765 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9766 LDKShutdown obj_conv;
9767 obj_conv.inner = (void*)(obj & (~1));
9768 obj_conv.is_owned = (obj & 1) || (obj == 0);
9769 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
9770 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9771 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9775 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9777 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9778 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9779 LDKShutdown ret = Shutdown_read(ser_ref);
9780 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9785 LDKUpdateFailHTLC obj_conv;
9786 obj_conv.inner = (void*)(obj & (~1));
9787 obj_conv.is_owned = (obj & 1) || (obj == 0);
9788 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
9789 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9790 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9796 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9797 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9798 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
9799 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9800 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9803 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9804 LDKUpdateFailMalformedHTLC obj_conv;
9805 obj_conv.inner = (void*)(obj & (~1));
9806 obj_conv.is_owned = (obj & 1) || (obj == 0);
9807 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
9808 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9809 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9813 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9815 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9816 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9817 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
9818 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9819 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9823 LDKUpdateFee obj_conv;
9824 obj_conv.inner = (void*)(obj & (~1));
9825 obj_conv.is_owned = (obj & 1) || (obj == 0);
9826 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
9827 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9828 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9834 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9835 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9836 LDKUpdateFee ret = UpdateFee_read(ser_ref);
9837 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9838 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9841 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9842 LDKUpdateFulfillHTLC obj_conv;
9843 obj_conv.inner = (void*)(obj & (~1));
9844 obj_conv.is_owned = (obj & 1) || (obj == 0);
9845 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
9846 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9847 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9851 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9853 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9854 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9855 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
9856 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9857 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9860 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9861 LDKUpdateAddHTLC obj_conv;
9862 obj_conv.inner = (void*)(obj & (~1));
9863 obj_conv.is_owned = (obj & 1) || (obj == 0);
9864 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
9865 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9866 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9872 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9873 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9874 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
9875 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9876 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9879 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9881 obj_conv.inner = (void*)(obj & (~1));
9882 obj_conv.is_owned = (obj & 1) || (obj == 0);
9883 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
9884 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9885 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9891 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9892 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9893 LDKPing ret = Ping_read(ser_ref);
9894 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9895 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9898 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9900 obj_conv.inner = (void*)(obj & (~1));
9901 obj_conv.is_owned = (obj & 1) || (obj == 0);
9902 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
9903 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9904 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_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 LDKPong ret = Pong_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 jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9918 LDKUnsignedChannelAnnouncement obj_conv;
9919 obj_conv.inner = (void*)(obj & (~1));
9920 obj_conv.is_owned = (obj & 1) || (obj == 0);
9921 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
9922 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9923 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9927 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9929 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9930 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9931 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
9932 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9933 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9936 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9937 LDKChannelAnnouncement obj_conv;
9938 obj_conv.inner = (void*)(obj & (~1));
9939 obj_conv.is_owned = (obj & 1) || (obj == 0);
9940 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
9941 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9942 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9946 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9948 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9949 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9950 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
9951 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9952 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9955 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9956 LDKUnsignedChannelUpdate obj_conv;
9957 obj_conv.inner = (void*)(obj & (~1));
9958 obj_conv.is_owned = (obj & 1) || (obj == 0);
9959 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
9960 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9961 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9967 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9968 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9969 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
9970 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9971 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9974 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9975 LDKChannelUpdate obj_conv;
9976 obj_conv.inner = (void*)(obj & (~1));
9977 obj_conv.is_owned = (obj & 1) || (obj == 0);
9978 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
9979 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9980 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
9984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9986 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9987 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9988 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
9989 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9990 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9993 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9994 LDKErrorMessage obj_conv;
9995 obj_conv.inner = (void*)(obj & (~1));
9996 obj_conv.is_owned = (obj & 1) || (obj == 0);
9997 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
9998 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
9999 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10004 LDKu8slice ser_ref;
10005 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10006 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10007 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10008 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10009 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10012 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10013 LDKUnsignedNodeAnnouncement obj_conv;
10014 obj_conv.inner = (void*)(obj & (~1));
10015 obj_conv.is_owned = (obj & 1) || (obj == 0);
10016 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10017 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10018 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10023 LDKu8slice ser_ref;
10024 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10025 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10026 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10027 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10028 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10031 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10032 LDKNodeAnnouncement obj_conv;
10033 obj_conv.inner = (void*)(obj & (~1));
10034 obj_conv.is_owned = (obj & 1) || (obj == 0);
10035 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10036 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10037 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10042 LDKu8slice ser_ref;
10043 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10044 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10045 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10046 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10047 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10050 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10051 LDKu8slice ser_ref;
10052 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10053 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10054 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10055 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10056 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10059 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10060 LDKQueryShortChannelIds obj_conv;
10061 obj_conv.inner = (void*)(obj & (~1));
10062 obj_conv.is_owned = (obj & 1) || (obj == 0);
10063 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10064 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10065 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10070 LDKu8slice ser_ref;
10071 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10072 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10073 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10074 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10075 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10078 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10079 LDKReplyShortChannelIdsEnd obj_conv;
10080 obj_conv.inner = (void*)(obj & (~1));
10081 obj_conv.is_owned = (obj & 1) || (obj == 0);
10082 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
10083 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10084 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10089 LDKu8slice ser_ref;
10090 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10091 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10092 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
10093 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10097 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10098 LDKQueryChannelRange obj_conv;
10099 obj_conv.inner = (void*)(obj & (~1));
10100 obj_conv.is_owned = (obj & 1) || (obj == 0);
10101 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
10102 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10103 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10107 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10108 LDKu8slice ser_ref;
10109 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10110 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10111 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
10112 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10113 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10116 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
10117 LDKReplyChannelRange obj_conv;
10118 obj_conv.inner = (void*)(obj & (~1));
10119 obj_conv.is_owned = (obj & 1) || (obj == 0);
10120 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
10121 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10122 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10127 LDKu8slice ser_ref;
10128 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10129 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10130 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
10131 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10132 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10135 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
10136 LDKGossipTimestampFilter obj_conv;
10137 obj_conv.inner = (void*)(obj & (~1));
10138 obj_conv.is_owned = (obj & 1) || (obj == 0);
10139 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
10140 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10141 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10146 LDKMessageHandler this_ptr_conv;
10147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10149 MessageHandler_free(this_ptr_conv);
10152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10153 LDKMessageHandler this_ptr_conv;
10154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10156 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
10160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10161 LDKMessageHandler this_ptr_conv;
10162 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10163 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10164 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
10165 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
10166 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10167 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
10169 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
10172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10173 LDKMessageHandler this_ptr_conv;
10174 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10175 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10176 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
10180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10181 LDKMessageHandler this_ptr_conv;
10182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10184 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
10185 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10186 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10187 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
10189 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
10192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
10193 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
10194 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
10195 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10196 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
10198 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
10199 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10200 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10201 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
10203 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
10204 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10207 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10208 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
10209 FREE((void*)this_ptr);
10210 SocketDescriptor_free(this_ptr_conv);
10213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10214 LDKPeerHandleError this_ptr_conv;
10215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10217 PeerHandleError_free(this_ptr_conv);
10220 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
10221 LDKPeerHandleError this_ptr_conv;
10222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10224 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
10228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10229 LDKPeerHandleError this_ptr_conv;
10230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10232 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
10235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
10236 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
10237 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10240 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10241 LDKPeerManager this_ptr_conv;
10242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10244 PeerManager_free(this_ptr_conv);
10247 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) {
10248 LDKMessageHandler message_handler_conv;
10249 message_handler_conv.inner = (void*)(message_handler & (~1));
10250 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
10251 // Warning: we may need a move here but can't clone!
10252 LDKSecretKey our_node_secret_ref;
10253 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
10254 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
10255 unsigned char ephemeral_random_data_arr[32];
10256 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
10257 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
10258 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
10259 LDKLogger logger_conv = *(LDKLogger*)logger;
10260 if (logger_conv.free == LDKLogger_JCalls_free) {
10261 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10262 LDKLogger_JCalls_clone(logger_conv.this_arg);
10264 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
10265 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10268 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
10269 LDKPeerManager this_arg_conv;
10270 this_arg_conv.inner = (void*)(this_arg & (~1));
10271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10272 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
10273 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
10277 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) {
10278 LDKPeerManager this_arg_conv;
10279 this_arg_conv.inner = (void*)(this_arg & (~1));
10280 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10281 LDKPublicKey their_node_id_ref;
10282 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
10283 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10284 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10285 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10286 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10287 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10289 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10290 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
10294 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10295 LDKPeerManager this_arg_conv;
10296 this_arg_conv.inner = (void*)(this_arg & (~1));
10297 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10298 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10299 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10300 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10301 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10303 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10304 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
10308 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10309 LDKPeerManager this_arg_conv;
10310 this_arg_conv.inner = (void*)(this_arg & (~1));
10311 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10312 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10313 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10314 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
10318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
10319 LDKPeerManager this_arg_conv;
10320 this_arg_conv.inner = (void*)(this_arg & (~1));
10321 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10322 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
10323 LDKu8slice data_ref;
10324 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
10325 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
10326 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10327 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
10328 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
10332 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
10333 LDKPeerManager this_arg_conv;
10334 this_arg_conv.inner = (void*)(this_arg & (~1));
10335 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10336 PeerManager_process_events(&this_arg_conv);
10339 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10340 LDKPeerManager this_arg_conv;
10341 this_arg_conv.inner = (void*)(this_arg & (~1));
10342 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10343 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10344 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
10347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
10348 LDKPeerManager this_arg_conv;
10349 this_arg_conv.inner = (void*)(this_arg & (~1));
10350 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10351 PeerManager_timer_tick_occured(&this_arg_conv);
10354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
10355 unsigned char commitment_seed_arr[32];
10356 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
10357 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
10358 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
10359 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10360 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
10364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
10365 LDKPublicKey per_commitment_point_ref;
10366 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10367 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10368 unsigned char base_secret_arr[32];
10369 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
10370 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
10371 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
10372 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10373 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
10377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
10378 LDKPublicKey per_commitment_point_ref;
10379 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10380 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10381 LDKPublicKey base_point_ref;
10382 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
10383 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
10384 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10385 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
10389 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) {
10390 unsigned char per_commitment_secret_arr[32];
10391 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
10392 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
10393 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
10394 unsigned char countersignatory_revocation_base_secret_arr[32];
10395 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
10396 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
10397 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
10398 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10399 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
10403 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) {
10404 LDKPublicKey per_commitment_point_ref;
10405 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10406 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10407 LDKPublicKey countersignatory_revocation_base_point_ref;
10408 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
10409 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
10410 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10411 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
10415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10416 LDKTxCreationKeys this_ptr_conv;
10417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10419 TxCreationKeys_free(this_ptr_conv);
10422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10423 LDKTxCreationKeys orig_conv;
10424 orig_conv.inner = (void*)(orig & (~1));
10425 orig_conv.is_owned = (orig & 1) || (orig == 0);
10426 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
10427 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10430 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10435 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
10439 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10440 LDKTxCreationKeys this_ptr_conv;
10441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10443 LDKPublicKey val_ref;
10444 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10445 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10446 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
10449 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10454 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
10458 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10459 LDKTxCreationKeys this_ptr_conv;
10460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10462 LDKPublicKey val_ref;
10463 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10464 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10465 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
10468 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10469 LDKTxCreationKeys this_ptr_conv;
10470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10472 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10473 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
10477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10478 LDKTxCreationKeys this_ptr_conv;
10479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10481 LDKPublicKey val_ref;
10482 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10483 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10484 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
10487 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10488 LDKTxCreationKeys this_ptr_conv;
10489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10491 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10492 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
10496 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10497 LDKTxCreationKeys this_ptr_conv;
10498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10500 LDKPublicKey val_ref;
10501 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10502 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10503 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
10506 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10507 LDKTxCreationKeys this_ptr_conv;
10508 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10509 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10510 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10511 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
10515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10516 LDKTxCreationKeys this_ptr_conv;
10517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10519 LDKPublicKey val_ref;
10520 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10521 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10522 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
10525 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) {
10526 LDKPublicKey per_commitment_point_arg_ref;
10527 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
10528 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
10529 LDKPublicKey revocation_key_arg_ref;
10530 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
10531 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
10532 LDKPublicKey broadcaster_htlc_key_arg_ref;
10533 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
10534 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
10535 LDKPublicKey countersignatory_htlc_key_arg_ref;
10536 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
10537 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
10538 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
10539 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
10540 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
10541 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);
10542 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10545 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10546 LDKTxCreationKeys obj_conv;
10547 obj_conv.inner = (void*)(obj & (~1));
10548 obj_conv.is_owned = (obj & 1) || (obj == 0);
10549 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
10550 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10551 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10555 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10556 LDKu8slice ser_ref;
10557 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10558 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10559 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
10560 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10565 LDKPreCalculatedTxCreationKeys this_ptr_conv;
10566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10568 PreCalculatedTxCreationKeys_free(this_ptr_conv);
10571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10572 LDKTxCreationKeys keys_conv;
10573 keys_conv.inner = (void*)(keys & (~1));
10574 keys_conv.is_owned = (keys & 1) || (keys == 0);
10575 if (keys_conv.inner != NULL)
10576 keys_conv = TxCreationKeys_clone(&keys_conv);
10577 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10578 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10582 LDKPreCalculatedTxCreationKeys this_arg_conv;
10583 this_arg_conv.inner = (void*)(this_arg & (~1));
10584 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10585 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10586 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10589 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10590 LDKPreCalculatedTxCreationKeys this_arg_conv;
10591 this_arg_conv.inner = (void*)(this_arg & (~1));
10592 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10593 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10594 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10598 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10599 LDKChannelPublicKeys this_ptr_conv;
10600 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10601 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10602 ChannelPublicKeys_free(this_ptr_conv);
10605 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10606 LDKChannelPublicKeys orig_conv;
10607 orig_conv.inner = (void*)(orig & (~1));
10608 orig_conv.is_owned = (orig & 1) || (orig == 0);
10609 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10610 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10613 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10614 LDKChannelPublicKeys this_ptr_conv;
10615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10622 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKPublicKey val_ref;
10627 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10628 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10629 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10633 LDKChannelPublicKeys this_ptr_conv;
10634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10636 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10637 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10642 LDKChannelPublicKeys this_ptr_conv;
10643 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10644 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10645 LDKPublicKey val_ref;
10646 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10647 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10648 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10651 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10652 LDKChannelPublicKeys this_ptr_conv;
10653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10655 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10656 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10660 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10661 LDKChannelPublicKeys this_ptr_conv;
10662 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10663 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10664 LDKPublicKey val_ref;
10665 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10666 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10667 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10671 LDKChannelPublicKeys this_ptr_conv;
10672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10674 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10675 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10680 LDKChannelPublicKeys this_ptr_conv;
10681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10683 LDKPublicKey val_ref;
10684 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10685 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10686 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10690 LDKChannelPublicKeys this_ptr_conv;
10691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10693 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10694 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10699 LDKChannelPublicKeys this_ptr_conv;
10700 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10701 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10702 LDKPublicKey val_ref;
10703 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10704 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10705 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10708 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) {
10709 LDKPublicKey funding_pubkey_arg_ref;
10710 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
10711 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10712 LDKPublicKey revocation_basepoint_arg_ref;
10713 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
10714 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10715 LDKPublicKey payment_point_arg_ref;
10716 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
10717 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10718 LDKPublicKey delayed_payment_basepoint_arg_ref;
10719 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
10720 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10721 LDKPublicKey htlc_basepoint_arg_ref;
10722 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
10723 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10724 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);
10725 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10728 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10729 LDKChannelPublicKeys obj_conv;
10730 obj_conv.inner = (void*)(obj & (~1));
10731 obj_conv.is_owned = (obj & 1) || (obj == 0);
10732 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
10733 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10734 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10739 LDKu8slice ser_ref;
10740 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10741 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10742 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
10743 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10744 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10747 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) {
10748 LDKPublicKey per_commitment_point_ref;
10749 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10750 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10751 LDKPublicKey broadcaster_delayed_payment_base_ref;
10752 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
10753 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10754 LDKPublicKey broadcaster_htlc_base_ref;
10755 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
10756 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10757 LDKPublicKey countersignatory_revocation_base_ref;
10758 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
10759 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10760 LDKPublicKey countersignatory_htlc_base_ref;
10761 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
10762 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10763 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10764 *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);
10768 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
10769 LDKPublicKey revocation_key_ref;
10770 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10771 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10772 LDKPublicKey broadcaster_delayed_payment_key_ref;
10773 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10774 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10775 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10776 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10777 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10781 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 HTLCOutputInCommitment_free(this_ptr_conv);
10788 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10789 LDKHTLCOutputInCommitment orig_conv;
10790 orig_conv.inner = (void*)(orig & (~1));
10791 orig_conv.is_owned = (orig & 1) || (orig == 0);
10792 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10793 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10796 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10797 LDKHTLCOutputInCommitment this_ptr_conv;
10798 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10799 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10800 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10804 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10805 LDKHTLCOutputInCommitment this_ptr_conv;
10806 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10807 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10808 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10811 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10812 LDKHTLCOutputInCommitment this_ptr_conv;
10813 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10814 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10815 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10819 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10820 LDKHTLCOutputInCommitment this_ptr_conv;
10821 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10822 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10823 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10826 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10827 LDKHTLCOutputInCommitment this_ptr_conv;
10828 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10829 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10830 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10834 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10835 LDKHTLCOutputInCommitment this_ptr_conv;
10836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10838 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10841 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10842 LDKHTLCOutputInCommitment this_ptr_conv;
10843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10845 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10846 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10851 LDKHTLCOutputInCommitment this_ptr_conv;
10852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10854 LDKThirtyTwoBytes val_ref;
10855 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10856 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10857 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10860 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10861 LDKHTLCOutputInCommitment obj_conv;
10862 obj_conv.inner = (void*)(obj & (~1));
10863 obj_conv.is_owned = (obj & 1) || (obj == 0);
10864 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
10865 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10866 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10871 LDKu8slice ser_ref;
10872 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10873 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10874 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
10875 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10876 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10879 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10880 LDKHTLCOutputInCommitment htlc_conv;
10881 htlc_conv.inner = (void*)(htlc & (~1));
10882 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10883 LDKTxCreationKeys keys_conv;
10884 keys_conv.inner = (void*)(keys & (~1));
10885 keys_conv.is_owned = (keys & 1) || (keys == 0);
10886 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10887 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10888 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10892 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10893 LDKPublicKey broadcaster_ref;
10894 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
10895 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10896 LDKPublicKey countersignatory_ref;
10897 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
10898 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10899 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10900 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10901 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10905 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) {
10906 unsigned char prev_hash_arr[32];
10907 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
10908 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10909 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10910 LDKHTLCOutputInCommitment htlc_conv;
10911 htlc_conv.inner = (void*)(htlc & (~1));
10912 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10913 LDKPublicKey broadcaster_delayed_payment_key_ref;
10914 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10915 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10916 LDKPublicKey revocation_key_ref;
10917 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10918 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10919 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10920 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10925 LDKHolderCommitmentTransaction this_ptr_conv;
10926 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10927 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10928 HolderCommitmentTransaction_free(this_ptr_conv);
10931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10932 LDKHolderCommitmentTransaction orig_conv;
10933 orig_conv.inner = (void*)(orig & (~1));
10934 orig_conv.is_owned = (orig & 1) || (orig == 0);
10935 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10936 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10940 LDKHolderCommitmentTransaction this_ptr_conv;
10941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10943 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10944 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10948 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10949 LDKHolderCommitmentTransaction this_ptr_conv;
10950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10952 LDKTransaction val_conv = *(LDKTransaction*)val;
10954 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10957 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10958 LDKHolderCommitmentTransaction this_ptr_conv;
10959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10961 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10962 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
10966 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10967 LDKHolderCommitmentTransaction this_ptr_conv;
10968 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10969 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10970 LDKSignature val_ref;
10971 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10972 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10973 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
10976 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10977 LDKHolderCommitmentTransaction this_ptr_conv;
10978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10980 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10985 LDKHolderCommitmentTransaction this_ptr_conv;
10986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10988 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10992 LDKHolderCommitmentTransaction this_ptr_conv;
10993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10995 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10997 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
11000 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) {
11001 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11002 FREE((void*)unsigned_tx);
11003 LDKSignature counterparty_sig_ref;
11004 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11005 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11006 LDKPublicKey holder_funding_key_ref;
11007 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11008 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11009 LDKPublicKey counterparty_funding_key_ref;
11010 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11011 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11012 LDKTxCreationKeys keys_conv;
11013 keys_conv.inner = (void*)(keys & (~1));
11014 keys_conv.is_owned = (keys & 1) || (keys == 0);
11015 if (keys_conv.inner != NULL)
11016 keys_conv = TxCreationKeys_clone(&keys_conv);
11017 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
11018 FREE((void*)htlc_data);
11019 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);
11020 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11024 LDKHolderCommitmentTransaction this_arg_conv;
11025 this_arg_conv.inner = (void*)(this_arg & (~1));
11026 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11027 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11028 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11031 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11032 LDKHolderCommitmentTransaction this_arg_conv;
11033 this_arg_conv.inner = (void*)(this_arg & (~1));
11034 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11035 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11036 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11040 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) {
11041 LDKHolderCommitmentTransaction this_arg_conv;
11042 this_arg_conv.inner = (void*)(this_arg & (~1));
11043 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11044 unsigned char funding_key_arr[32];
11045 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
11046 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
11047 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
11048 LDKu8slice funding_redeemscript_ref;
11049 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
11050 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
11051 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11052 (*_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);
11053 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
11057 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) {
11058 LDKHolderCommitmentTransaction this_arg_conv;
11059 this_arg_conv.inner = (void*)(this_arg & (~1));
11060 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11061 unsigned char htlc_base_key_arr[32];
11062 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
11063 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
11064 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
11065 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
11066 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
11070 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
11071 LDKHolderCommitmentTransaction obj_conv;
11072 obj_conv.inner = (void*)(obj & (~1));
11073 obj_conv.is_owned = (obj & 1) || (obj == 0);
11074 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
11075 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11076 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11080 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11081 LDKu8slice ser_ref;
11082 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11083 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11084 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
11085 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11086 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11090 LDKInitFeatures this_ptr_conv;
11091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11093 InitFeatures_free(this_ptr_conv);
11096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11097 LDKNodeFeatures this_ptr_conv;
11098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11100 NodeFeatures_free(this_ptr_conv);
11103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11104 LDKChannelFeatures this_ptr_conv;
11105 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11106 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11107 ChannelFeatures_free(this_ptr_conv);
11110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11111 LDKRouteHop this_ptr_conv;
11112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11114 RouteHop_free(this_ptr_conv);
11117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11118 LDKRouteHop orig_conv;
11119 orig_conv.inner = (void*)(orig & (~1));
11120 orig_conv.is_owned = (orig & 1) || (orig == 0);
11121 LDKRouteHop ret = RouteHop_clone(&orig_conv);
11122 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11125 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11126 LDKRouteHop this_ptr_conv;
11127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11129 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11130 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
11134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11135 LDKRouteHop this_ptr_conv;
11136 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11137 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11138 LDKPublicKey val_ref;
11139 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11140 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11141 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
11144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11145 LDKRouteHop this_ptr_conv;
11146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11148 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
11149 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11152 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11153 LDKRouteHop this_ptr_conv;
11154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11156 LDKNodeFeatures val_conv;
11157 val_conv.inner = (void*)(val & (~1));
11158 val_conv.is_owned = (val & 1) || (val == 0);
11159 // Warning: we may need a move here but can't clone!
11160 RouteHop_set_node_features(&this_ptr_conv, val_conv);
11163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11164 LDKRouteHop this_ptr_conv;
11165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11167 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
11171 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11172 LDKRouteHop this_ptr_conv;
11173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11175 RouteHop_set_short_channel_id(&this_ptr_conv, val);
11178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11179 LDKRouteHop this_ptr_conv;
11180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11182 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
11183 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11187 LDKRouteHop this_ptr_conv;
11188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11190 LDKChannelFeatures val_conv;
11191 val_conv.inner = (void*)(val & (~1));
11192 val_conv.is_owned = (val & 1) || (val == 0);
11193 // Warning: we may need a move here but can't clone!
11194 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
11197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11198 LDKRouteHop this_ptr_conv;
11199 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11200 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11201 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
11205 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11206 LDKRouteHop this_ptr_conv;
11207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11209 RouteHop_set_fee_msat(&this_ptr_conv, val);
11212 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11213 LDKRouteHop this_ptr_conv;
11214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11216 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
11220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11221 LDKRouteHop this_ptr_conv;
11222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11224 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
11227 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) {
11228 LDKPublicKey pubkey_arg_ref;
11229 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
11230 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
11231 LDKNodeFeatures node_features_arg_conv;
11232 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
11233 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
11234 // Warning: we may need a move here but can't clone!
11235 LDKChannelFeatures channel_features_arg_conv;
11236 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
11237 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
11238 // Warning: we may need a move here but can't clone!
11239 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);
11240 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11243 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11244 LDKRoute 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 Route_free(this_ptr_conv);
11250 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11251 LDKRoute orig_conv;
11252 orig_conv.inner = (void*)(orig & (~1));
11253 orig_conv.is_owned = (orig & 1) || (orig == 0);
11254 LDKRoute ret = Route_clone(&orig_conv);
11255 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11258 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11259 LDKRoute this_ptr_conv;
11260 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11261 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11262 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
11264 Route_set_paths(&this_ptr_conv, val_conv);
11267 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
11268 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
11269 FREE((void*)paths_arg);
11270 LDKRoute ret = Route_new(paths_arg_conv);
11271 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11274 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
11276 obj_conv.inner = (void*)(obj & (~1));
11277 obj_conv.is_owned = (obj & 1) || (obj == 0);
11278 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
11279 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11280 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11284 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11285 LDKu8slice ser_ref;
11286 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11287 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11288 LDKRoute ret = Route_read(ser_ref);
11289 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11290 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11294 LDKRouteHint this_ptr_conv;
11295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11297 RouteHint_free(this_ptr_conv);
11300 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11301 LDKRouteHint orig_conv;
11302 orig_conv.inner = (void*)(orig & (~1));
11303 orig_conv.is_owned = (orig & 1) || (orig == 0);
11304 LDKRouteHint ret = RouteHint_clone(&orig_conv);
11305 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11308 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11309 LDKRouteHint this_ptr_conv;
11310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11312 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11313 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
11317 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11318 LDKRouteHint this_ptr_conv;
11319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11321 LDKPublicKey val_ref;
11322 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11323 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11324 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
11327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11328 LDKRouteHint this_ptr_conv;
11329 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11330 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11331 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
11335 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11336 LDKRouteHint this_ptr_conv;
11337 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11338 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11339 RouteHint_set_short_channel_id(&this_ptr_conv, val);
11342 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11343 LDKRouteHint this_ptr_conv;
11344 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11345 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11346 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
11347 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11351 LDKRouteHint this_ptr_conv;
11352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11354 LDKRoutingFees val_conv;
11355 val_conv.inner = (void*)(val & (~1));
11356 val_conv.is_owned = (val & 1) || (val == 0);
11357 if (val_conv.inner != NULL)
11358 val_conv = RoutingFees_clone(&val_conv);
11359 RouteHint_set_fees(&this_ptr_conv, val_conv);
11362 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11363 LDKRouteHint this_ptr_conv;
11364 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11365 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11366 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
11370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11371 LDKRouteHint this_ptr_conv;
11372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11374 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
11377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11378 LDKRouteHint this_ptr_conv;
11379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11381 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
11385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11386 LDKRouteHint this_ptr_conv;
11387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11389 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
11392 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) {
11393 LDKPublicKey src_node_id_arg_ref;
11394 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
11395 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
11396 LDKRoutingFees fees_arg_conv;
11397 fees_arg_conv.inner = (void*)(fees_arg & (~1));
11398 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
11399 if (fees_arg_conv.inner != NULL)
11400 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
11401 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
11402 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11405 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) {
11406 LDKPublicKey our_node_id_ref;
11407 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
11408 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
11409 LDKNetworkGraph network_conv;
11410 network_conv.inner = (void*)(network & (~1));
11411 network_conv.is_owned = (network & 1) || (network == 0);
11412 LDKPublicKey target_ref;
11413 CHECK((*_env)->GetArrayLength (_env, target) == 33);
11414 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
11415 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
11416 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
11417 FREE((void*)last_hops);
11418 LDKLogger logger_conv = *(LDKLogger*)logger;
11419 if (logger_conv.free == LDKLogger_JCalls_free) {
11420 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11421 LDKLogger_JCalls_clone(logger_conv.this_arg);
11423 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11424 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
11428 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11429 LDKNetworkGraph this_ptr_conv;
11430 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11431 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11432 NetworkGraph_free(this_ptr_conv);
11435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11436 LDKLockedNetworkGraph this_ptr_conv;
11437 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11438 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11439 LockedNetworkGraph_free(this_ptr_conv);
11442 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11443 LDKNetGraphMsgHandler this_ptr_conv;
11444 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11445 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11446 NetGraphMsgHandler_free(this_ptr_conv);
11449 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
11450 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11451 LDKLogger logger_conv = *(LDKLogger*)logger;
11452 if (logger_conv.free == LDKLogger_JCalls_free) {
11453 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11454 LDKLogger_JCalls_clone(logger_conv.this_arg);
11456 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
11457 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
11461 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11462 LDKLogger logger_conv = *(LDKLogger*)logger;
11463 if (logger_conv.free == LDKLogger_JCalls_free) {
11464 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11465 LDKLogger_JCalls_clone(logger_conv.this_arg);
11467 LDKNetworkGraph network_graph_conv;
11468 network_graph_conv.inner = (void*)(network_graph & (~1));
11469 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
11470 // Warning: we may need a move here but can't clone!
11471 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
11472 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11476 LDKNetGraphMsgHandler this_arg_conv;
11477 this_arg_conv.inner = (void*)(this_arg & (~1));
11478 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11479 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
11480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11484 LDKLockedNetworkGraph this_arg_conv;
11485 this_arg_conv.inner = (void*)(this_arg & (~1));
11486 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11487 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
11488 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11491 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
11492 LDKNetGraphMsgHandler this_arg_conv;
11493 this_arg_conv.inner = (void*)(this_arg & (~1));
11494 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11495 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11496 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
11500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11501 LDKDirectionalChannelInfo this_ptr_conv;
11502 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11503 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11504 DirectionalChannelInfo_free(this_ptr_conv);
11507 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11508 LDKDirectionalChannelInfo this_ptr_conv;
11509 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11510 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11511 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
11515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11516 LDKDirectionalChannelInfo this_ptr_conv;
11517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11519 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
11522 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
11523 LDKDirectionalChannelInfo this_ptr_conv;
11524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11526 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
11530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11531 LDKDirectionalChannelInfo this_ptr_conv;
11532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11534 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
11537 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11538 LDKDirectionalChannelInfo this_ptr_conv;
11539 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11540 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11541 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
11545 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11546 LDKDirectionalChannelInfo this_ptr_conv;
11547 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11548 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11549 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
11552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11553 LDKDirectionalChannelInfo this_ptr_conv;
11554 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11555 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11556 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
11560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11561 LDKDirectionalChannelInfo this_ptr_conv;
11562 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11563 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11564 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
11567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11568 LDKDirectionalChannelInfo this_ptr_conv;
11569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11571 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
11572 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11575 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11576 LDKDirectionalChannelInfo this_ptr_conv;
11577 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11578 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11579 LDKChannelUpdate val_conv;
11580 val_conv.inner = (void*)(val & (~1));
11581 val_conv.is_owned = (val & 1) || (val == 0);
11582 if (val_conv.inner != NULL)
11583 val_conv = ChannelUpdate_clone(&val_conv);
11584 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
11587 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11588 LDKDirectionalChannelInfo obj_conv;
11589 obj_conv.inner = (void*)(obj & (~1));
11590 obj_conv.is_owned = (obj & 1) || (obj == 0);
11591 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
11592 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11593 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11598 LDKu8slice ser_ref;
11599 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11600 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11601 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
11602 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11603 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11607 LDKChannelInfo this_ptr_conv;
11608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11610 ChannelInfo_free(this_ptr_conv);
11613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11614 LDKChannelInfo this_ptr_conv;
11615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11617 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
11618 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11622 LDKChannelInfo this_ptr_conv;
11623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11625 LDKChannelFeatures val_conv;
11626 val_conv.inner = (void*)(val & (~1));
11627 val_conv.is_owned = (val & 1) || (val == 0);
11628 // Warning: we may need a move here but can't clone!
11629 ChannelInfo_set_features(&this_ptr_conv, val_conv);
11632 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11633 LDKChannelInfo this_ptr_conv;
11634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11636 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11637 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
11641 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray 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 LDKPublicKey val_ref;
11646 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11647 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11648 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
11651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11652 LDKChannelInfo this_ptr_conv;
11653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11655 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
11656 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11660 LDKChannelInfo this_ptr_conv;
11661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11663 LDKDirectionalChannelInfo val_conv;
11664 val_conv.inner = (void*)(val & (~1));
11665 val_conv.is_owned = (val & 1) || (val == 0);
11666 // Warning: we may need a move here but can't clone!
11667 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11670 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11671 LDKChannelInfo this_ptr_conv;
11672 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11673 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11674 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11675 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11680 LDKChannelInfo this_ptr_conv;
11681 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11682 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11683 LDKPublicKey val_ref;
11684 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11685 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11686 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11690 LDKChannelInfo this_ptr_conv;
11691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11693 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11694 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11697 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11698 LDKChannelInfo this_ptr_conv;
11699 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11700 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11701 LDKDirectionalChannelInfo val_conv;
11702 val_conv.inner = (void*)(val & (~1));
11703 val_conv.is_owned = (val & 1) || (val == 0);
11704 // Warning: we may need a move here but can't clone!
11705 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11709 LDKChannelInfo this_ptr_conv;
11710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11712 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11713 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11717 LDKChannelInfo this_ptr_conv;
11718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11720 LDKChannelAnnouncement val_conv;
11721 val_conv.inner = (void*)(val & (~1));
11722 val_conv.is_owned = (val & 1) || (val == 0);
11723 if (val_conv.inner != NULL)
11724 val_conv = ChannelAnnouncement_clone(&val_conv);
11725 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11728 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11729 LDKChannelInfo obj_conv;
11730 obj_conv.inner = (void*)(obj & (~1));
11731 obj_conv.is_owned = (obj & 1) || (obj == 0);
11732 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
11733 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11734 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11739 LDKu8slice ser_ref;
11740 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11741 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11742 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
11743 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11744 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11748 LDKRoutingFees this_ptr_conv;
11749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11751 RoutingFees_free(this_ptr_conv);
11754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11755 LDKRoutingFees orig_conv;
11756 orig_conv.inner = (void*)(orig & (~1));
11757 orig_conv.is_owned = (orig & 1) || (orig == 0);
11758 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11759 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11762 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11763 LDKRoutingFees this_ptr_conv;
11764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11766 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
11770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11771 LDKRoutingFees this_ptr_conv;
11772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11774 RoutingFees_set_base_msat(&this_ptr_conv, val);
11777 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11778 LDKRoutingFees this_ptr_conv;
11779 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11780 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11781 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
11785 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11786 LDKRoutingFees this_ptr_conv;
11787 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11788 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11789 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11792 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11793 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11794 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11797 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11798 LDKu8slice ser_ref;
11799 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11800 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11801 LDKRoutingFees ret = RoutingFees_read(ser_ref);
11802 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11803 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11806 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11807 LDKRoutingFees obj_conv;
11808 obj_conv.inner = (void*)(obj & (~1));
11809 obj_conv.is_owned = (obj & 1) || (obj == 0);
11810 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
11811 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11812 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11817 LDKNodeAnnouncementInfo this_ptr_conv;
11818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11820 NodeAnnouncementInfo_free(this_ptr_conv);
11823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11824 LDKNodeAnnouncementInfo this_ptr_conv;
11825 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11826 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11827 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11832 LDKNodeAnnouncementInfo this_ptr_conv;
11833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11835 LDKNodeFeatures val_conv;
11836 val_conv.inner = (void*)(val & (~1));
11837 val_conv.is_owned = (val & 1) || (val == 0);
11838 // Warning: we may need a move here but can't clone!
11839 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11842 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11843 LDKNodeAnnouncementInfo this_ptr_conv;
11844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11846 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11851 LDKNodeAnnouncementInfo this_ptr_conv;
11852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11854 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11857 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11858 LDKNodeAnnouncementInfo this_ptr_conv;
11859 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11860 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11861 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11862 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11866 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11867 LDKNodeAnnouncementInfo this_ptr_conv;
11868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11870 LDKThreeBytes val_ref;
11871 CHECK((*_env)->GetArrayLength (_env, val) == 3);
11872 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
11873 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
11876 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11877 LDKNodeAnnouncementInfo this_ptr_conv;
11878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11880 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11881 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11885 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11886 LDKNodeAnnouncementInfo this_ptr_conv;
11887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11889 LDKThirtyTwoBytes val_ref;
11890 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11891 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11892 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11896 LDKNodeAnnouncementInfo this_ptr_conv;
11897 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11898 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11899 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11901 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11905 LDKNodeAnnouncementInfo this_ptr_conv;
11906 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11907 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11908 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11909 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11913 LDKNodeAnnouncementInfo this_ptr_conv;
11914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11916 LDKNodeAnnouncement val_conv;
11917 val_conv.inner = (void*)(val & (~1));
11918 val_conv.is_owned = (val & 1) || (val == 0);
11919 if (val_conv.inner != NULL)
11920 val_conv = NodeAnnouncement_clone(&val_conv);
11921 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11924 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) {
11925 LDKNodeFeatures features_arg_conv;
11926 features_arg_conv.inner = (void*)(features_arg & (~1));
11927 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11928 // Warning: we may need a move here but can't clone!
11929 LDKThreeBytes rgb_arg_ref;
11930 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
11931 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
11932 LDKThirtyTwoBytes alias_arg_ref;
11933 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
11934 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11935 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11936 FREE((void*)addresses_arg);
11937 LDKNodeAnnouncement announcement_message_arg_conv;
11938 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11939 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11940 if (announcement_message_arg_conv.inner != NULL)
11941 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11942 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11943 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11946 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11947 LDKNodeAnnouncementInfo obj_conv;
11948 obj_conv.inner = (void*)(obj & (~1));
11949 obj_conv.is_owned = (obj & 1) || (obj == 0);
11950 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
11951 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11952 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11957 LDKu8slice ser_ref;
11958 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11959 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11960 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
11961 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11962 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11965 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11966 LDKNodeInfo this_ptr_conv;
11967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11969 NodeInfo_free(this_ptr_conv);
11972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11973 LDKNodeInfo this_ptr_conv;
11974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11976 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11978 NodeInfo_set_channels(&this_ptr_conv, val_conv);
11981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11982 LDKNodeInfo this_ptr_conv;
11983 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11984 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11985 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11986 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11990 LDKNodeInfo this_ptr_conv;
11991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11993 LDKRoutingFees val_conv;
11994 val_conv.inner = (void*)(val & (~1));
11995 val_conv.is_owned = (val & 1) || (val == 0);
11996 if (val_conv.inner != NULL)
11997 val_conv = RoutingFees_clone(&val_conv);
11998 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
12001 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
12002 LDKNodeInfo this_ptr_conv;
12003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12005 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
12006 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12009 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12010 LDKNodeInfo this_ptr_conv;
12011 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12012 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12013 LDKNodeAnnouncementInfo val_conv;
12014 val_conv.inner = (void*)(val & (~1));
12015 val_conv.is_owned = (val & 1) || (val == 0);
12016 // Warning: we may need a move here but can't clone!
12017 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
12020 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) {
12021 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
12022 FREE((void*)channels_arg);
12023 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
12024 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
12025 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
12026 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
12027 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
12028 LDKNodeAnnouncementInfo announcement_info_arg_conv;
12029 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
12030 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
12031 // Warning: we may need a move here but can't clone!
12032 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
12033 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12036 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12037 LDKNodeInfo obj_conv;
12038 obj_conv.inner = (void*)(obj & (~1));
12039 obj_conv.is_owned = (obj & 1) || (obj == 0);
12040 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
12041 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12042 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12046 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12047 LDKu8slice ser_ref;
12048 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12049 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12050 LDKNodeInfo ret = NodeInfo_read(ser_ref);
12051 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12052 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12055 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
12056 LDKNetworkGraph obj_conv;
12057 obj_conv.inner = (void*)(obj & (~1));
12058 obj_conv.is_owned = (obj & 1) || (obj == 0);
12059 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
12060 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12061 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12066 LDKu8slice ser_ref;
12067 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12068 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12069 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
12070 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12071 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12074 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
12075 LDKNetworkGraph ret = NetworkGraph_new();
12076 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12079 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) {
12080 LDKNetworkGraph this_arg_conv;
12081 this_arg_conv.inner = (void*)(this_arg & (~1));
12082 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12083 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);