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 jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
454 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
455 if (val->result_ok) {
456 return (long)val->contents.result;
458 return (long)val->contents.err;
461 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
462 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
465 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
466 if (val->result_ok) {
467 return (long)val->contents.result;
469 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
473 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
475 a_conv.inner = (void*)(a & (~1));
476 a_conv.is_owned = (a & 1) || (a == 0);
477 if (a_conv.inner != NULL)
478 a_conv = OutPoint_clone(&a_conv);
480 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
485 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
486 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
487 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
490 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
491 ret->datalen = (*env)->GetArrayLength(env, elems);
492 if (ret->datalen == 0) {
495 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
496 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
497 for (size_t i = 0; i < ret->datalen; i++) {
498 jlong arr_elem = java_elems[i];
499 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
500 FREE((void*)arr_elem);
501 ret->data[i] = arr_elem_conv;
503 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
508 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
509 LDKThirtyTwoBytes a_ref;
510 CHECK((*_env)->GetArrayLength (_env, a) == 32);
511 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
513 LDKCVecTempl_TxOut b_conv = *(LDKCVecTempl_TxOut*)b;
518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
519 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
524 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
525 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
526 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
528 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlong b) {
529 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
531 CHECK((*_env)->GetArrayLength (_env, a) == 64);
532 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
534 LDKCVecTempl_Signature b_conv = *(LDKCVecTempl_Signature*)b;
539 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
540 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
543 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
544 if (val->result_ok) {
545 return (long)val->contents.result;
547 return (long)val->contents.err;
550 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
551 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
554 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
555 if (val->result_ok) {
556 return (long)val->contents.result;
558 return (long)val->contents.err;
561 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
562 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
565 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
566 if (val->result_ok) {
567 return (long)val->contents.result;
569 return (long)val->contents.err;
572 static jclass LDKAPIError_APIMisuseError_class = NULL;
573 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
574 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
575 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
576 static jclass LDKAPIError_RouteError_class = NULL;
577 static jmethodID LDKAPIError_RouteError_meth = NULL;
578 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
579 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
580 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
581 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
583 LDKAPIError_APIMisuseError_class =
584 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
585 CHECK(LDKAPIError_APIMisuseError_class != NULL);
586 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "(J)V");
587 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
588 LDKAPIError_FeeRateTooHigh_class =
589 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
590 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
591 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "(JI)V");
592 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
593 LDKAPIError_RouteError_class =
594 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
595 CHECK(LDKAPIError_RouteError_class != NULL);
596 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(J)V");
597 CHECK(LDKAPIError_RouteError_meth != NULL);
598 LDKAPIError_ChannelUnavailable_class =
599 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
600 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
601 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "(J)V");
602 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
603 LDKAPIError_MonitorUpdateFailed_class =
604 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
605 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
606 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
607 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
609 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
610 LDKAPIError *obj = (LDKAPIError*)ptr;
612 case LDKAPIError_APIMisuseError: {
613 long err_ref = (long)&obj->api_misuse_error.err;
614 return (*env)->NewObject(env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_ref);
616 case LDKAPIError_FeeRateTooHigh: {
617 long err_ref = (long)&obj->fee_rate_too_high.err;
618 return (*env)->NewObject(env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_ref, obj->fee_rate_too_high.feerate);
620 case LDKAPIError_RouteError: {
621 long err_ref = (long)&obj->route_error.err;
622 return (*env)->NewObject(env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_ref);
624 case LDKAPIError_ChannelUnavailable: {
625 long err_ref = (long)&obj->channel_unavailable.err;
626 return (*env)->NewObject(env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_ref);
628 case LDKAPIError_MonitorUpdateFailed: {
629 return (*env)->NewObject(env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
634 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
635 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
638 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
639 if (val->result_ok) {
640 return (long)val->contents.result;
642 return (long)val->contents.err;
645 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
646 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
648 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
649 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
650 if (val->result_ok) {
651 return (long)val->contents.result;
653 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
656 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) {
657 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
658 LDKChannelAnnouncement a_conv;
659 a_conv.inner = (void*)(a & (~1));
660 a_conv.is_owned = (a & 1) || (a == 0);
661 if (a_conv.inner != NULL)
662 a_conv = ChannelAnnouncement_clone(&a_conv);
664 LDKChannelUpdate b_conv;
665 b_conv.inner = (void*)(b & (~1));
666 b_conv.is_owned = (b & 1) || (b == 0);
667 if (b_conv.inner != NULL)
668 b_conv = ChannelUpdate_clone(&b_conv);
670 LDKChannelUpdate c_conv;
671 c_conv.inner = (void*)(c & (~1));
672 c_conv.is_owned = (c & 1) || (c == 0);
673 if (c_conv.inner != NULL)
674 c_conv = ChannelUpdate_clone(&c_conv);
678 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
679 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
682 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
683 if (val->result_ok) {
684 return (long)val->contents.result;
686 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
689 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
690 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
691 LDKHTLCOutputInCommitment 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 = HTLCOutputInCommitment_clone(&a_conv);
698 CHECK((*_env)->GetArrayLength (_env, b) == 64);
699 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
703 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
704 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
705 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
706 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
707 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
708 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
710 LDKSpendableOutputDescriptor_StaticOutput_class =
711 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
712 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
713 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
714 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
715 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
716 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
717 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
718 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
719 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
720 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
721 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
722 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
723 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
724 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
726 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
727 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
729 case LDKSpendableOutputDescriptor_StaticOutput: {
730 LDKOutPoint outpoint_var = obj->static_output.outpoint;
731 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
732 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
734 if (outpoint_var.is_owned) {
735 outpoint_ref = (long)outpoint_var.inner | 1;
737 outpoint_ref = (long)&outpoint_var;
739 long output_ref = (long)&obj->static_output.output;
740 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
742 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
743 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
744 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
745 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
747 if (outpoint_var.is_owned) {
748 outpoint_ref = (long)outpoint_var.inner | 1;
750 outpoint_ref = (long)&outpoint_var;
752 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
753 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
754 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
755 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
756 jbyteArray revocation_pubkey_arr = (*env)->NewByteArray(env, 33);
757 (*env)->SetByteArrayRegion(env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
758 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);
760 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
761 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
762 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
763 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
765 if (outpoint_var.is_owned) {
766 outpoint_ref = (long)outpoint_var.inner | 1;
768 outpoint_ref = (long)&outpoint_var;
770 long output_ref = (long)&obj->static_output_counterparty_payment.output;
771 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
772 return (*env)->NewObject(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
777 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
778 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
779 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
782 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
783 ret->datalen = (*env)->GetArrayLength(env, elems);
784 if (ret->datalen == 0) {
787 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
788 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
789 for (size_t i = 0; i < ret->datalen; i++) {
790 jlong arr_elem = java_elems[i];
791 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
792 FREE((void*)arr_elem);
793 ret->data[i] = arr_elem_conv;
795 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
799 static jclass LDKEvent_FundingGenerationReady_class = NULL;
800 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
801 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
802 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
803 static jclass LDKEvent_PaymentReceived_class = NULL;
804 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
805 static jclass LDKEvent_PaymentSent_class = NULL;
806 static jmethodID LDKEvent_PaymentSent_meth = NULL;
807 static jclass LDKEvent_PaymentFailed_class = NULL;
808 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
809 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
810 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
811 static jclass LDKEvent_SpendableOutputs_class = NULL;
812 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
814 LDKEvent_FundingGenerationReady_class =
815 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
816 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
817 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJJJ)V");
818 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
819 LDKEvent_FundingBroadcastSafe_class =
820 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
821 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
822 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
823 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
824 LDKEvent_PaymentReceived_class =
825 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
826 CHECK(LDKEvent_PaymentReceived_class != NULL);
827 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
828 CHECK(LDKEvent_PaymentReceived_meth != NULL);
829 LDKEvent_PaymentSent_class =
830 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
831 CHECK(LDKEvent_PaymentSent_class != NULL);
832 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
833 CHECK(LDKEvent_PaymentSent_meth != NULL);
834 LDKEvent_PaymentFailed_class =
835 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
836 CHECK(LDKEvent_PaymentFailed_class != NULL);
837 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
838 CHECK(LDKEvent_PaymentFailed_meth != NULL);
839 LDKEvent_PendingHTLCsForwardable_class =
840 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
841 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
842 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
843 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
844 LDKEvent_SpendableOutputs_class =
845 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
846 CHECK(LDKEvent_SpendableOutputs_class != NULL);
847 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "(J)V");
848 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
850 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
851 LDKEvent *obj = (LDKEvent*)ptr;
853 case LDKEvent_FundingGenerationReady: {
854 jbyteArray temporary_channel_id_arr = (*env)->NewByteArray(env, 32);
855 (*env)->SetByteArrayRegion(env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
856 long output_script_ref = (long)&obj->funding_generation_ready.output_script;
857 return (*env)->NewObject(env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_ref, obj->funding_generation_ready.user_channel_id);
859 case LDKEvent_FundingBroadcastSafe: {
860 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
861 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
862 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
863 long funding_txo_ref;
864 if (funding_txo_var.is_owned) {
865 funding_txo_ref = (long)funding_txo_var.inner | 1;
867 funding_txo_ref = (long)&funding_txo_var;
869 return (*env)->NewObject(env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
871 case LDKEvent_PaymentReceived: {
872 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
873 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
874 jbyteArray payment_secret_arr = (*env)->NewByteArray(env, 32);
875 (*env)->SetByteArrayRegion(env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
876 return (*env)->NewObject(env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
878 case LDKEvent_PaymentSent: {
879 jbyteArray payment_preimage_arr = (*env)->NewByteArray(env, 32);
880 (*env)->SetByteArrayRegion(env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
881 return (*env)->NewObject(env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
883 case LDKEvent_PaymentFailed: {
884 jbyteArray payment_hash_arr = (*env)->NewByteArray(env, 32);
885 (*env)->SetByteArrayRegion(env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
886 return (*env)->NewObject(env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
888 case LDKEvent_PendingHTLCsForwardable: {
889 return (*env)->NewObject(env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
891 case LDKEvent_SpendableOutputs: {
892 long outputs_ref = (long)&obj->spendable_outputs.outputs;
893 return (*env)->NewObject(env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_ref);
898 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
899 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
900 static jclass LDKErrorAction_IgnoreError_class = NULL;
901 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
902 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
903 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
905 LDKErrorAction_DisconnectPeer_class =
906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
907 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
908 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
909 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
910 LDKErrorAction_IgnoreError_class =
911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
912 CHECK(LDKErrorAction_IgnoreError_class != NULL);
913 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
914 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
915 LDKErrorAction_SendErrorMessage_class =
916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
917 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
918 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
919 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
921 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
922 LDKErrorAction *obj = (LDKErrorAction*)ptr;
924 case LDKErrorAction_DisconnectPeer: {
925 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
926 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
927 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
929 if (msg_var.is_owned) {
930 msg_ref = (long)msg_var.inner | 1;
932 msg_ref = (long)&msg_var;
934 return (*env)->NewObject(env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
936 case LDKErrorAction_IgnoreError: {
937 return (*env)->NewObject(env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
939 case LDKErrorAction_SendErrorMessage: {
940 LDKErrorMessage msg_var = obj->send_error_message.msg;
941 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
942 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
944 if (msg_var.is_owned) {
945 msg_ref = (long)msg_var.inner | 1;
947 msg_ref = (long)&msg_var;
949 return (*env)->NewObject(env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
954 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
955 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
956 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
957 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
958 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
959 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
961 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
962 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
963 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
964 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
965 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
966 LDKHTLCFailChannelUpdate_ChannelClosed_class =
967 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
968 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
969 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
970 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
971 LDKHTLCFailChannelUpdate_NodeFailure_class =
972 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
973 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
974 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
975 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
977 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
978 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
980 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
981 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
982 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
983 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
985 if (msg_var.is_owned) {
986 msg_ref = (long)msg_var.inner | 1;
988 msg_ref = (long)&msg_var;
990 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
992 case LDKHTLCFailChannelUpdate_ChannelClosed: {
993 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
995 case LDKHTLCFailChannelUpdate_NodeFailure: {
996 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
997 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
998 return (*env)->NewObject(env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1003 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1004 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1005 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1006 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1007 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1008 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1009 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1010 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1011 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1012 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1013 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1014 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1015 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1016 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1017 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1018 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1019 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1020 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1021 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1022 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1023 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1024 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1025 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1026 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1027 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1028 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1029 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1030 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1031 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1032 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1033 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1034 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1036 LDKMessageSendEvent_SendAcceptChannel_class =
1037 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1038 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1039 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1040 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1041 LDKMessageSendEvent_SendOpenChannel_class =
1042 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1043 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1044 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1045 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1046 LDKMessageSendEvent_SendFundingCreated_class =
1047 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1048 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1049 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1050 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1051 LDKMessageSendEvent_SendFundingSigned_class =
1052 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1053 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1054 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1055 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1056 LDKMessageSendEvent_SendFundingLocked_class =
1057 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1058 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1059 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1060 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1061 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1062 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1063 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1064 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1065 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1066 LDKMessageSendEvent_UpdateHTLCs_class =
1067 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1068 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1069 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1070 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1071 LDKMessageSendEvent_SendRevokeAndACK_class =
1072 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1073 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1074 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1075 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1076 LDKMessageSendEvent_SendClosingSigned_class =
1077 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1078 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1079 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1080 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1081 LDKMessageSendEvent_SendShutdown_class =
1082 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1083 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1084 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1085 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1086 LDKMessageSendEvent_SendChannelReestablish_class =
1087 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1088 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1089 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1090 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1091 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1092 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1093 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1094 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1095 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1096 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1097 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1098 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1099 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1100 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1101 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1102 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1103 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1104 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1105 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1106 LDKMessageSendEvent_HandleError_class =
1107 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1108 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1109 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1110 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1111 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1112 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1113 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1114 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1115 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1117 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
1118 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1120 case LDKMessageSendEvent_SendAcceptChannel: {
1121 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1122 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1123 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1124 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1125 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1127 if (msg_var.is_owned) {
1128 msg_ref = (long)msg_var.inner | 1;
1130 msg_ref = (long)&msg_var;
1132 return (*env)->NewObject(env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1134 case LDKMessageSendEvent_SendOpenChannel: {
1135 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1136 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1137 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1138 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1139 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1141 if (msg_var.is_owned) {
1142 msg_ref = (long)msg_var.inner | 1;
1144 msg_ref = (long)&msg_var;
1146 return (*env)->NewObject(env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1148 case LDKMessageSendEvent_SendFundingCreated: {
1149 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1150 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1151 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1152 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1153 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1155 if (msg_var.is_owned) {
1156 msg_ref = (long)msg_var.inner | 1;
1158 msg_ref = (long)&msg_var;
1160 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1162 case LDKMessageSendEvent_SendFundingSigned: {
1163 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1164 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1165 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1166 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1167 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1169 if (msg_var.is_owned) {
1170 msg_ref = (long)msg_var.inner | 1;
1172 msg_ref = (long)&msg_var;
1174 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1176 case LDKMessageSendEvent_SendFundingLocked: {
1177 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1178 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1179 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1180 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1181 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1183 if (msg_var.is_owned) {
1184 msg_ref = (long)msg_var.inner | 1;
1186 msg_ref = (long)&msg_var;
1188 return (*env)->NewObject(env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1190 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1191 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1192 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1193 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1194 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1195 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1197 if (msg_var.is_owned) {
1198 msg_ref = (long)msg_var.inner | 1;
1200 msg_ref = (long)&msg_var;
1202 return (*env)->NewObject(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1204 case LDKMessageSendEvent_UpdateHTLCs: {
1205 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1206 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1207 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1208 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1209 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1211 if (updates_var.is_owned) {
1212 updates_ref = (long)updates_var.inner | 1;
1214 updates_ref = (long)&updates_var;
1216 return (*env)->NewObject(env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1218 case LDKMessageSendEvent_SendRevokeAndACK: {
1219 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1220 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1221 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1222 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1223 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1225 if (msg_var.is_owned) {
1226 msg_ref = (long)msg_var.inner | 1;
1228 msg_ref = (long)&msg_var;
1230 return (*env)->NewObject(env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1232 case LDKMessageSendEvent_SendClosingSigned: {
1233 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1234 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1235 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1236 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1237 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1239 if (msg_var.is_owned) {
1240 msg_ref = (long)msg_var.inner | 1;
1242 msg_ref = (long)&msg_var;
1244 return (*env)->NewObject(env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1246 case LDKMessageSendEvent_SendShutdown: {
1247 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1248 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1249 LDKShutdown msg_var = obj->send_shutdown.msg;
1250 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1251 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1253 if (msg_var.is_owned) {
1254 msg_ref = (long)msg_var.inner | 1;
1256 msg_ref = (long)&msg_var;
1258 return (*env)->NewObject(env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1260 case LDKMessageSendEvent_SendChannelReestablish: {
1261 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1262 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1263 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1264 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1265 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1267 if (msg_var.is_owned) {
1268 msg_ref = (long)msg_var.inner | 1;
1270 msg_ref = (long)&msg_var;
1272 return (*env)->NewObject(env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1274 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1275 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1276 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1277 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1279 if (msg_var.is_owned) {
1280 msg_ref = (long)msg_var.inner | 1;
1282 msg_ref = (long)&msg_var;
1284 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1285 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1286 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1287 long update_msg_ref;
1288 if (update_msg_var.is_owned) {
1289 update_msg_ref = (long)update_msg_var.inner | 1;
1291 update_msg_ref = (long)&update_msg_var;
1293 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1295 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1296 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1297 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1298 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1300 if (msg_var.is_owned) {
1301 msg_ref = (long)msg_var.inner | 1;
1303 msg_ref = (long)&msg_var;
1305 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1307 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1308 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1309 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1310 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1312 if (msg_var.is_owned) {
1313 msg_ref = (long)msg_var.inner | 1;
1315 msg_ref = (long)&msg_var;
1317 return (*env)->NewObject(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1319 case LDKMessageSendEvent_HandleError: {
1320 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
1321 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1322 long action_ref = (long)&obj->handle_error.action;
1323 return (*env)->NewObject(env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1325 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1326 long update_ref = (long)&obj->payment_failure_network_update.update;
1327 return (*env)->NewObject(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1332 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1333 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1334 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1337 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1338 ret->datalen = (*env)->GetArrayLength(env, elems);
1339 if (ret->datalen == 0) {
1342 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1343 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1344 for (size_t i = 0; i < ret->datalen; i++) {
1345 jlong arr_elem = java_elems[i];
1346 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1347 FREE((void*)arr_elem);
1348 ret->data[i] = arr_elem_conv;
1350 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1354 typedef struct LDKMessageSendEventsProvider_JCalls {
1355 atomic_size_t refcnt;
1358 jmethodID get_and_clear_pending_msg_events_meth;
1359 } LDKMessageSendEventsProvider_JCalls;
1360 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1361 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1363 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1364 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1366 LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1367 LDKCVec_MessageSendEventZ res = *ret;
1371 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1372 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1373 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1375 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1376 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1380 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1381 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1382 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1383 return (void*) this_arg;
1385 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1386 jclass c = (*env)->GetObjectClass(env, o);
1388 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1389 atomic_init(&calls->refcnt, 1);
1390 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1391 calls->o = (*env)->NewWeakGlobalRef(env, o);
1392 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
1393 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1395 LDKMessageSendEventsProvider ret = {
1396 .this_arg = (void*) calls,
1397 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1398 .free = LDKMessageSendEventsProvider_JCalls_free,
1402 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1403 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1404 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1405 return (long)res_ptr;
1407 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1408 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1413 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1414 LDKCVec_MessageSendEventZ* ret = MALLOC(sizeof(LDKCVec_MessageSendEventZ), "LDKCVec_MessageSendEventZ");
1415 *ret = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1419 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1420 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1421 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1424 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1425 ret->datalen = (*env)->GetArrayLength(env, elems);
1426 if (ret->datalen == 0) {
1429 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1430 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1431 for (size_t i = 0; i < ret->datalen; i++) {
1432 jlong arr_elem = java_elems[i];
1433 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1434 FREE((void*)arr_elem);
1435 ret->data[i] = arr_elem_conv;
1437 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1441 typedef struct LDKEventsProvider_JCalls {
1442 atomic_size_t refcnt;
1445 jmethodID get_and_clear_pending_events_meth;
1446 } LDKEventsProvider_JCalls;
1447 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1448 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1450 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1451 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1453 LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*env)->CallLongMethod(env, obj, j_calls->get_and_clear_pending_events_meth);
1454 LDKCVec_EventZ res = *ret;
1458 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1459 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1460 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1462 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1463 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1467 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1468 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1469 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1470 return (void*) this_arg;
1472 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1473 jclass c = (*env)->GetObjectClass(env, o);
1475 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1476 atomic_init(&calls->refcnt, 1);
1477 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1478 calls->o = (*env)->NewWeakGlobalRef(env, o);
1479 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
1480 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1482 LDKEventsProvider ret = {
1483 .this_arg = (void*) calls,
1484 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1485 .free = LDKEventsProvider_JCalls_free,
1489 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1490 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1491 *res_ptr = LDKEventsProvider_init(env, _a, o);
1492 return (long)res_ptr;
1494 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1495 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1500 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1501 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
1502 *ret = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1506 typedef struct LDKLogger_JCalls {
1507 atomic_size_t refcnt;
1512 void log_jcall(const void* this_arg, const char *record) {
1513 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1515 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1516 jstring record_conv = (*env)->NewStringUTF(env, record);
1517 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1519 return (*env)->CallVoidMethod(env, obj, j_calls->log_meth, record_conv);
1521 static void LDKLogger_JCalls_free(void* this_arg) {
1522 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1523 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1525 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1526 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1530 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1531 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1532 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1533 return (void*) this_arg;
1535 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1536 jclass c = (*env)->GetObjectClass(env, o);
1538 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1539 atomic_init(&calls->refcnt, 1);
1540 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1541 calls->o = (*env)->NewWeakGlobalRef(env, o);
1542 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1543 CHECK(calls->log_meth != NULL);
1546 .this_arg = (void*) calls,
1548 .free = LDKLogger_JCalls_free,
1552 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1553 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1554 *res_ptr = LDKLogger_init(env, _a, o);
1555 return (long)res_ptr;
1557 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1558 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1562 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1563 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1565 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
1566 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1567 if (val->result_ok) {
1568 return (long)val->contents.result;
1570 return (long)val->contents.err;
1573 typedef struct LDKAccess_JCalls {
1574 atomic_size_t refcnt;
1577 jmethodID get_utxo_meth;
1579 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1580 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1582 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1583 jbyteArray genesis_hash_arr = (*env)->NewByteArray(env, 32);
1584 (*env)->SetByteArrayRegion(env, genesis_hash_arr, 0, 32, *genesis_hash);
1585 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1587 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1588 LDKCResult_TxOutAccessErrorZ res = *ret;
1592 static void LDKAccess_JCalls_free(void* this_arg) {
1593 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1594 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1596 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1597 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1601 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1602 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1603 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1604 return (void*) this_arg;
1606 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1607 jclass c = (*env)->GetObjectClass(env, o);
1609 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1610 atomic_init(&calls->refcnt, 1);
1611 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1612 calls->o = (*env)->NewWeakGlobalRef(env, o);
1613 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1614 CHECK(calls->get_utxo_meth != NULL);
1617 .this_arg = (void*) calls,
1618 .get_utxo = get_utxo_jcall,
1619 .free = LDKAccess_JCalls_free,
1623 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1624 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1625 *res_ptr = LDKAccess_init(env, _a, o);
1626 return (long)res_ptr;
1628 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1629 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1633 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) {
1634 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1635 unsigned char genesis_hash_arr[32];
1636 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1637 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1638 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1639 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1640 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1644 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1645 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1646 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1647 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1648 for (size_t i = 0; i < vec->datalen; i++) {
1649 CHECK((((long)vec->data[i].inner) & 1) == 0);
1650 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1652 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1656 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1657 ret->datalen = (*env)->GetArrayLength(env, elems);
1658 if (ret->datalen == 0) {
1661 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1662 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1663 for (size_t i = 0; i < ret->datalen; i++) {
1664 jlong arr_elem = java_elems[i];
1665 LDKHTLCOutputInCommitment arr_elem_conv;
1666 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1667 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1668 if (arr_elem_conv.inner != NULL)
1669 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1670 ret->data[i] = arr_elem_conv;
1672 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1676 typedef struct LDKChannelKeys_JCalls {
1677 atomic_size_t refcnt;
1680 jmethodID get_per_commitment_point_meth;
1681 jmethodID release_commitment_secret_meth;
1682 jmethodID key_derivation_params_meth;
1683 jmethodID sign_counterparty_commitment_meth;
1684 jmethodID sign_holder_commitment_meth;
1685 jmethodID sign_holder_commitment_htlc_transactions_meth;
1686 jmethodID sign_justice_transaction_meth;
1687 jmethodID sign_counterparty_htlc_transaction_meth;
1688 jmethodID sign_closing_transaction_meth;
1689 jmethodID sign_channel_announcement_meth;
1690 jmethodID on_accept_meth;
1691 } LDKChannelKeys_JCalls;
1692 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1693 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1695 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1696 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1698 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_per_commitment_point_meth, idx);
1700 CHECK((*env)->GetArrayLength(env, jret) == 33);
1701 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
1704 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1705 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1707 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1708 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1710 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->release_commitment_secret_meth, idx);
1711 LDKThirtyTwoBytes ret;
1712 CHECK((*env)->GetArrayLength(env, jret) == 32);
1713 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
1716 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1717 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1719 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1720 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1722 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*env)->CallLongMethod(env, obj, j_calls->key_derivation_params_meth);
1723 LDKC2Tuple_u64u64Z res = *ret;
1727 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) {
1728 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1730 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1731 long commitment_tx_ref = (long)&commitment_tx;
1732 long htlcs_ref = (long)&htlcs;
1733 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1735 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);
1736 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1740 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1741 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1743 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1744 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1746 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1747 LDKCResult_SignatureNoneZ res = *ret;
1751 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1752 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1754 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1755 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1757 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1758 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1762 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) {
1763 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1765 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1766 long justice_tx_ref = (long)&justice_tx;
1767 jbyteArray per_commitment_key_arr = (*env)->NewByteArray(env, 32);
1768 (*env)->SetByteArrayRegion(env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1769 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1771 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);
1772 LDKCResult_SignatureNoneZ res = *ret;
1776 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) {
1777 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1779 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1780 long htlc_tx_ref = (long)&htlc_tx;
1781 jbyteArray per_commitment_point_arr = (*env)->NewByteArray(env, 33);
1782 (*env)->SetByteArrayRegion(env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1783 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1785 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);
1786 LDKCResult_SignatureNoneZ res = *ret;
1790 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1791 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1793 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1794 long closing_tx_ref = (long)&closing_tx;
1795 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1797 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1798 LDKCResult_SignatureNoneZ res = *ret;
1802 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1803 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1805 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1806 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1808 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*env)->CallLongMethod(env, obj, j_calls->sign_channel_announcement_meth, msg);
1809 LDKCResult_SignatureNoneZ res = *ret;
1813 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1814 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1817 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
1819 return (*env)->CallVoidMethod(env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1821 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1822 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1823 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1825 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1826 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1830 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1831 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1832 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1833 return (void*) this_arg;
1835 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1836 jclass c = (*env)->GetObjectClass(env, o);
1838 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1839 atomic_init(&calls->refcnt, 1);
1840 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1841 calls->o = (*env)->NewWeakGlobalRef(env, o);
1842 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1843 CHECK(calls->get_per_commitment_point_meth != NULL);
1844 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
1845 CHECK(calls->release_commitment_secret_meth != NULL);
1846 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
1847 CHECK(calls->key_derivation_params_meth != NULL);
1848 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJJ)J");
1849 CHECK(calls->sign_counterparty_commitment_meth != NULL);
1850 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
1851 CHECK(calls->sign_holder_commitment_meth != NULL);
1852 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
1853 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
1854 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
1855 CHECK(calls->sign_justice_transaction_meth != NULL);
1856 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
1857 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
1858 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
1859 CHECK(calls->sign_closing_transaction_meth != NULL);
1860 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
1861 CHECK(calls->sign_channel_announcement_meth != NULL);
1862 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
1863 CHECK(calls->on_accept_meth != NULL);
1865 LDKChannelKeys ret = {
1866 .this_arg = (void*) calls,
1867 .get_per_commitment_point = get_per_commitment_point_jcall,
1868 .release_commitment_secret = release_commitment_secret_jcall,
1869 .key_derivation_params = key_derivation_params_jcall,
1870 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
1871 .sign_holder_commitment = sign_holder_commitment_jcall,
1872 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
1873 .sign_justice_transaction = sign_justice_transaction_jcall,
1874 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
1875 .sign_closing_transaction = sign_closing_transaction_jcall,
1876 .sign_channel_announcement = sign_channel_announcement_jcall,
1877 .on_accept = on_accept_jcall,
1878 .clone = LDKChannelKeys_JCalls_clone,
1879 .free = LDKChannelKeys_JCalls_free,
1883 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
1884 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
1885 *res_ptr = LDKChannelKeys_init(env, _a, o);
1886 return (long)res_ptr;
1888 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1889 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
1893 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1894 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1895 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
1896 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
1900 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
1901 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1902 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
1903 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
1907 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
1908 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1909 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1910 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
1914 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) {
1915 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1916 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
1917 FREE((void*)commitment_tx);
1918 LDKPreCalculatedTxCreationKeys keys_conv;
1919 keys_conv.inner = (void*)(keys & (~1));
1920 keys_conv.is_owned = (keys & 1) || (keys == 0);
1921 LDKCVec_HTLCOutputInCommitmentZ htlcs_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)htlcs;
1923 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1924 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_conv);
1928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
1929 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1930 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1931 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1932 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1933 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1934 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1938 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) {
1939 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1940 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
1941 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
1942 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
1943 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1944 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
1948 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) {
1949 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1950 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
1951 FREE((void*)justice_tx);
1952 unsigned char per_commitment_key_arr[32];
1953 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
1954 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
1955 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
1956 LDKHTLCOutputInCommitment htlc_conv;
1957 htlc_conv.inner = (void*)(htlc & (~1));
1958 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1959 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1960 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
1964 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) {
1965 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1966 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
1967 FREE((void*)htlc_tx);
1968 LDKPublicKey per_commitment_point_ref;
1969 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
1970 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
1971 LDKHTLCOutputInCommitment htlc_conv;
1972 htlc_conv.inner = (void*)(htlc & (~1));
1973 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
1974 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1975 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
1979 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
1980 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1981 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
1982 FREE((void*)closing_tx);
1983 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1984 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
1988 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
1989 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
1990 LDKUnsignedChannelAnnouncement msg_conv;
1991 msg_conv.inner = (void*)(msg & (~1));
1992 msg_conv.is_owned = (msg & 1) || (msg == 0);
1993 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1994 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
1998 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) {
1999 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2000 LDKChannelPublicKeys channel_points_conv;
2001 channel_points_conv.inner = (void*)(channel_points & (~1));
2002 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2003 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2006 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2007 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2008 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2009 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2010 for (size_t i = 0; i < vec->datalen; i++) {
2011 CHECK((((long)vec->data[i].inner) & 1) == 0);
2012 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2014 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2017 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2018 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2019 ret->datalen = (*env)->GetArrayLength(env, elems);
2020 if (ret->datalen == 0) {
2023 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2024 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2025 for (size_t i = 0; i < ret->datalen; i++) {
2026 jlong arr_elem = java_elems[i];
2027 LDKMonitorEvent arr_elem_conv;
2028 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2029 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2030 // Warning: we may need a move here but can't clone!
2031 ret->data[i] = arr_elem_conv;
2033 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2037 typedef struct LDKWatch_JCalls {
2038 atomic_size_t refcnt;
2041 jmethodID watch_channel_meth;
2042 jmethodID update_channel_meth;
2043 jmethodID release_pending_monitor_events_meth;
2045 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2046 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2048 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2049 LDKOutPoint funding_txo_var = funding_txo;
2050 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2051 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2052 long funding_txo_ref;
2053 if (funding_txo_var.is_owned) {
2054 funding_txo_ref = (long)funding_txo_var.inner | 1;
2056 funding_txo_ref = (long)&funding_txo_var;
2058 LDKChannelMonitor monitor_var = monitor;
2059 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2060 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2062 if (monitor_var.is_owned) {
2063 monitor_ref = (long)monitor_var.inner | 1;
2065 monitor_ref = (long)&monitor_var;
2067 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2069 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2070 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2074 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2075 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2077 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2078 LDKOutPoint funding_txo_var = funding_txo;
2079 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2080 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2081 long funding_txo_ref;
2082 if (funding_txo_var.is_owned) {
2083 funding_txo_ref = (long)funding_txo_var.inner | 1;
2085 funding_txo_ref = (long)&funding_txo_var;
2087 LDKChannelMonitorUpdate update_var = update;
2088 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2089 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2091 if (update_var.is_owned) {
2092 update_ref = (long)update_var.inner | 1;
2094 update_ref = (long)&update_var;
2096 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2098 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*env)->CallLongMethod(env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2099 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2103 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2104 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2106 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2107 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2109 LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*env)->CallLongMethod(env, obj, j_calls->release_pending_monitor_events_meth);
2110 LDKCVec_MonitorEventZ res = *ret;
2114 static void LDKWatch_JCalls_free(void* this_arg) {
2115 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2116 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2118 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2119 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2123 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2124 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2125 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2126 return (void*) this_arg;
2128 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2129 jclass c = (*env)->GetObjectClass(env, o);
2131 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2132 atomic_init(&calls->refcnt, 1);
2133 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2134 calls->o = (*env)->NewWeakGlobalRef(env, o);
2135 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2136 CHECK(calls->watch_channel_meth != NULL);
2137 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2138 CHECK(calls->update_channel_meth != NULL);
2139 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()J");
2140 CHECK(calls->release_pending_monitor_events_meth != NULL);
2143 .this_arg = (void*) calls,
2144 .watch_channel = watch_channel_jcall,
2145 .update_channel = update_channel_jcall,
2146 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2147 .free = LDKWatch_JCalls_free,
2151 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2152 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2153 *res_ptr = LDKWatch_init(env, _a, o);
2154 return (long)res_ptr;
2156 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2157 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2161 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2162 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2163 LDKOutPoint funding_txo_conv;
2164 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2165 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2166 if (funding_txo_conv.inner != NULL)
2167 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2168 LDKChannelMonitor monitor_conv;
2169 monitor_conv.inner = (void*)(monitor & (~1));
2170 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2171 // Warning: we may need a move here but can't clone!
2172 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2173 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2178 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2179 LDKOutPoint funding_txo_conv;
2180 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2181 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2182 if (funding_txo_conv.inner != NULL)
2183 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2184 LDKChannelMonitorUpdate update_conv;
2185 update_conv.inner = (void*)(update & (~1));
2186 update_conv.is_owned = (update & 1) || (update == 0);
2187 if (update_conv.inner != NULL)
2188 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2189 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2190 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2195 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2196 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
2197 *ret = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2201 typedef struct LDKFilter_JCalls {
2202 atomic_size_t refcnt;
2205 jmethodID register_tx_meth;
2206 jmethodID register_output_meth;
2208 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2209 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2211 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2212 jbyteArray txid_arr = (*env)->NewByteArray(env, 32);
2213 (*env)->SetByteArrayRegion(env, txid_arr, 0, 32, *txid);
2214 LDKu8slice script_pubkey_var = script_pubkey;
2215 jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
2216 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2217 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2219 return (*env)->CallVoidMethod(env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2221 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2222 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2224 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2225 LDKu8slice script_pubkey_var = script_pubkey;
2226 jbyteArray script_pubkey_arr = (*env)->NewByteArray(env, script_pubkey_var.datalen);
2227 (*env)->SetByteArrayRegion(env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2228 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2230 return (*env)->CallVoidMethod(env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2232 static void LDKFilter_JCalls_free(void* this_arg) {
2233 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2234 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2236 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2237 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2241 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2242 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2243 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2244 return (void*) this_arg;
2246 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2247 jclass c = (*env)->GetObjectClass(env, o);
2249 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2250 atomic_init(&calls->refcnt, 1);
2251 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2252 calls->o = (*env)->NewWeakGlobalRef(env, o);
2253 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2254 CHECK(calls->register_tx_meth != NULL);
2255 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2256 CHECK(calls->register_output_meth != NULL);
2259 .this_arg = (void*) calls,
2260 .register_tx = register_tx_jcall,
2261 .register_output = register_output_jcall,
2262 .free = LDKFilter_JCalls_free,
2266 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2267 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2268 *res_ptr = LDKFilter_init(env, _a, o);
2269 return (long)res_ptr;
2271 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2272 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2277 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2278 unsigned char txid_arr[32];
2279 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2280 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2281 unsigned char (*txid_ref)[32] = &txid_arr;
2282 LDKu8slice script_pubkey_ref;
2283 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2284 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2285 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2286 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2290 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2291 LDKOutPoint outpoint_conv;
2292 outpoint_conv.inner = (void*)(outpoint & (~1));
2293 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2294 LDKu8slice script_pubkey_ref;
2295 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2296 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2297 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2298 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2301 typedef struct LDKBroadcasterInterface_JCalls {
2302 atomic_size_t refcnt;
2305 jmethodID broadcast_transaction_meth;
2306 } LDKBroadcasterInterface_JCalls;
2307 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2308 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2310 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2311 long tx_ref = (long)&tx;
2312 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2314 return (*env)->CallVoidMethod(env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2316 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2317 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2318 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2320 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2321 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2325 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2326 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2327 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2328 return (void*) this_arg;
2330 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2331 jclass c = (*env)->GetObjectClass(env, o);
2333 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2334 atomic_init(&calls->refcnt, 1);
2335 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2336 calls->o = (*env)->NewWeakGlobalRef(env, o);
2337 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2338 CHECK(calls->broadcast_transaction_meth != NULL);
2340 LDKBroadcasterInterface ret = {
2341 .this_arg = (void*) calls,
2342 .broadcast_transaction = broadcast_transaction_jcall,
2343 .free = LDKBroadcasterInterface_JCalls_free,
2347 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2348 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2349 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2350 return (long)res_ptr;
2352 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2353 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2358 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2359 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2361 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2364 typedef struct LDKFeeEstimator_JCalls {
2365 atomic_size_t refcnt;
2368 jmethodID get_est_sat_per_1000_weight_meth;
2369 } LDKFeeEstimator_JCalls;
2370 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2371 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2373 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2374 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(env, confirmation_target);
2375 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2377 return (*env)->CallIntMethod(env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2379 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2380 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2381 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2383 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2384 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2388 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2389 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2390 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2391 return (void*) this_arg;
2393 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2394 jclass c = (*env)->GetObjectClass(env, o);
2396 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2397 atomic_init(&calls->refcnt, 1);
2398 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2399 calls->o = (*env)->NewWeakGlobalRef(env, o);
2400 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2401 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2403 LDKFeeEstimator ret = {
2404 .this_arg = (void*) calls,
2405 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2406 .free = LDKFeeEstimator_JCalls_free,
2410 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2411 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2412 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2413 return (long)res_ptr;
2415 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2416 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2420 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) {
2421 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2422 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2423 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2427 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2428 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2429 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2432 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2433 ret->datalen = (*env)->GetArrayLength(env, elems);
2434 if (ret->datalen == 0) {
2437 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2438 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2439 for (size_t i = 0; i < ret->datalen; i++) {
2440 jlong arr_elem = java_elems[i];
2441 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2442 FREE((void*)arr_elem);
2443 ret->data[i] = arr_elem_conv;
2445 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2449 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2450 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2451 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2454 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2455 ret->datalen = (*env)->GetArrayLength(env, elems);
2456 if (ret->datalen == 0) {
2459 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2460 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2461 for (size_t i = 0; i < ret->datalen; i++) {
2462 jlong arr_elem = java_elems[i];
2463 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2464 FREE((void*)arr_elem);
2465 ret->data[i] = arr_elem_conv;
2467 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2471 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2472 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2473 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2476 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2477 ret->datalen = (*env)->GetArrayLength(env, elems);
2478 if (ret->datalen == 0) {
2481 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2482 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2483 for (size_t i = 0; i < ret->datalen; i++) {
2484 jlong arr_elem = java_elems[i];
2485 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2486 FREE((void*)arr_elem);
2487 ret->data[i] = arr_elem_conv;
2489 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2493 typedef struct LDKKeysInterface_JCalls {
2494 atomic_size_t refcnt;
2497 jmethodID get_node_secret_meth;
2498 jmethodID get_destination_script_meth;
2499 jmethodID get_shutdown_pubkey_meth;
2500 jmethodID get_channel_keys_meth;
2501 jmethodID get_secure_random_bytes_meth;
2502 } LDKKeysInterface_JCalls;
2503 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2504 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2506 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2507 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2509 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_node_secret_meth);
2511 CHECK((*env)->GetArrayLength(env, jret) == 32);
2512 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.bytes);
2515 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2516 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2518 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2519 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2521 LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*env)->CallLongMethod(env, obj, j_calls->get_destination_script_meth);
2522 LDKCVec_u8Z res = *ret;
2526 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2527 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2529 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2530 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2532 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_shutdown_pubkey_meth);
2534 CHECK((*env)->GetArrayLength(env, jret) == 33);
2535 (*env)->GetByteArrayRegion(env, jret, 0, 33, ret.compressed_form);
2538 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2539 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2541 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2542 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2544 LDKChannelKeys* ret = (LDKChannelKeys*)(*env)->CallLongMethod(env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2545 LDKChannelKeys res = *ret;
2549 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2550 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2552 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2553 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2555 jbyteArray jret = (*env)->CallObjectMethod(env, obj, j_calls->get_secure_random_bytes_meth);
2556 LDKThirtyTwoBytes ret;
2557 CHECK((*env)->GetArrayLength(env, jret) == 32);
2558 (*env)->GetByteArrayRegion(env, jret, 0, 32, ret.data);
2561 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2562 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2563 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2565 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2566 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2570 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2571 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2572 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2573 return (void*) this_arg;
2575 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2576 jclass c = (*env)->GetObjectClass(env, o);
2578 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2579 atomic_init(&calls->refcnt, 1);
2580 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2581 calls->o = (*env)->NewWeakGlobalRef(env, o);
2582 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2583 CHECK(calls->get_node_secret_meth != NULL);
2584 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
2585 CHECK(calls->get_destination_script_meth != NULL);
2586 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2587 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2588 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2589 CHECK(calls->get_channel_keys_meth != NULL);
2590 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2591 CHECK(calls->get_secure_random_bytes_meth != NULL);
2593 LDKKeysInterface ret = {
2594 .this_arg = (void*) calls,
2595 .get_node_secret = get_node_secret_jcall,
2596 .get_destination_script = get_destination_script_jcall,
2597 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2598 .get_channel_keys = get_channel_keys_jcall,
2599 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2600 .free = LDKKeysInterface_JCalls_free,
2604 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2605 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2606 *res_ptr = LDKKeysInterface_init(env, _a, o);
2607 return (long)res_ptr;
2609 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2610 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2614 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2615 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2616 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2617 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2622 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2623 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2624 *ret = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2628 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2629 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2630 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2631 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2635 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) {
2636 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2637 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2638 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2642 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2643 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2644 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2645 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2649 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2650 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2651 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2652 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2653 for (size_t i = 0; i < vec->datalen; i++) {
2654 CHECK((((long)vec->data[i].inner) & 1) == 0);
2655 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2657 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2661 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2662 ret->datalen = (*env)->GetArrayLength(env, elems);
2663 if (ret->datalen == 0) {
2666 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2667 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2668 for (size_t i = 0; i < ret->datalen; i++) {
2669 jlong arr_elem = java_elems[i];
2670 LDKChannelDetails arr_elem_conv;
2671 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2672 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2673 if (arr_elem_conv.inner != NULL)
2674 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2675 ret->data[i] = arr_elem_conv;
2677 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2681 static jclass LDKNetAddress_IPv4_class = NULL;
2682 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2683 static jclass LDKNetAddress_IPv6_class = NULL;
2684 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2685 static jclass LDKNetAddress_OnionV2_class = NULL;
2686 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2687 static jclass LDKNetAddress_OnionV3_class = NULL;
2688 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2690 LDKNetAddress_IPv4_class =
2691 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2692 CHECK(LDKNetAddress_IPv4_class != NULL);
2693 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "(JS)V");
2694 CHECK(LDKNetAddress_IPv4_meth != NULL);
2695 LDKNetAddress_IPv6_class =
2696 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2697 CHECK(LDKNetAddress_IPv6_class != NULL);
2698 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "(JS)V");
2699 CHECK(LDKNetAddress_IPv6_meth != NULL);
2700 LDKNetAddress_OnionV2_class =
2701 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2702 CHECK(LDKNetAddress_OnionV2_class != NULL);
2703 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "(JS)V");
2704 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2705 LDKNetAddress_OnionV3_class =
2706 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2707 CHECK(LDKNetAddress_OnionV3_class != NULL);
2708 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2709 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2711 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * env, jclass _c, jlong ptr) {
2712 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2714 case LDKNetAddress_IPv4: {
2715 long addr_ref = (long)&obj->i_pv4.addr;
2716 return (*env)->NewObject(env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_ref, obj->i_pv4.port);
2718 case LDKNetAddress_IPv6: {
2719 long addr_ref = (long)&obj->i_pv6.addr;
2720 return (*env)->NewObject(env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_ref, obj->i_pv6.port);
2722 case LDKNetAddress_OnionV2: {
2723 long addr_ref = (long)&obj->onion_v2.addr;
2724 return (*env)->NewObject(env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_ref, obj->onion_v2.port);
2726 case LDKNetAddress_OnionV3: {
2727 jbyteArray ed25519_pubkey_arr = (*env)->NewByteArray(env, 32);
2728 (*env)->SetByteArrayRegion(env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2729 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);
2734 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2735 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2736 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2738 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2739 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2740 ret->datalen = (*env)->GetArrayLength(env, elems);
2741 if (ret->datalen == 0) {
2744 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2745 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2746 for (size_t i = 0; i < ret->datalen; i++) {
2747 jlong arr_elem = java_elems[i];
2748 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2749 FREE((void*)arr_elem);
2750 ret->data[i] = arr_elem_conv;
2752 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2756 typedef struct LDKChannelMessageHandler_JCalls {
2757 atomic_size_t refcnt;
2760 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2761 jmethodID handle_open_channel_meth;
2762 jmethodID handle_accept_channel_meth;
2763 jmethodID handle_funding_created_meth;
2764 jmethodID handle_funding_signed_meth;
2765 jmethodID handle_funding_locked_meth;
2766 jmethodID handle_shutdown_meth;
2767 jmethodID handle_closing_signed_meth;
2768 jmethodID handle_update_add_htlc_meth;
2769 jmethodID handle_update_fulfill_htlc_meth;
2770 jmethodID handle_update_fail_htlc_meth;
2771 jmethodID handle_update_fail_malformed_htlc_meth;
2772 jmethodID handle_commitment_signed_meth;
2773 jmethodID handle_revoke_and_ack_meth;
2774 jmethodID handle_update_fee_meth;
2775 jmethodID handle_announcement_signatures_meth;
2776 jmethodID peer_disconnected_meth;
2777 jmethodID peer_connected_meth;
2778 jmethodID handle_channel_reestablish_meth;
2779 jmethodID handle_error_meth;
2780 } LDKChannelMessageHandler_JCalls;
2781 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2782 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2784 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2785 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2786 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2787 LDKInitFeatures their_features_var = their_features;
2788 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2789 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2790 long their_features_ref;
2791 if (their_features_var.is_owned) {
2792 their_features_ref = (long)their_features_var.inner | 1;
2794 their_features_ref = (long)&their_features_var;
2796 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2798 return (*env)->CallVoidMethod(env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
2800 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
2801 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2803 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2804 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2805 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2806 LDKInitFeatures their_features_var = their_features;
2807 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2808 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2809 long their_features_ref;
2810 if (their_features_var.is_owned) {
2811 their_features_ref = (long)their_features_var.inner | 1;
2813 their_features_ref = (long)&their_features_var;
2815 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2817 return (*env)->CallVoidMethod(env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
2819 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
2820 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2822 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2823 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2824 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2825 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2827 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
2829 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
2830 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2832 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2833 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2834 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2835 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2837 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
2839 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
2840 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2842 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2843 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2844 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2845 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2847 return (*env)->CallVoidMethod(env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
2849 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
2850 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2852 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2853 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2854 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2855 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2857 return (*env)->CallVoidMethod(env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
2859 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
2860 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2862 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2863 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2864 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2865 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2867 return (*env)->CallVoidMethod(env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
2869 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
2870 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2872 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2873 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2874 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2875 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2877 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
2879 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
2880 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2882 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2883 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2884 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2885 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2887 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
2889 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
2890 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2892 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2893 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2894 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2895 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2897 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
2899 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
2900 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2902 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2903 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2904 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2905 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2907 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
2909 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
2910 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2912 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2913 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2914 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2915 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2917 return (*env)->CallVoidMethod(env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
2919 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
2920 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2922 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2923 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2924 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2925 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2927 return (*env)->CallVoidMethod(env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
2929 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
2930 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2932 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2933 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2934 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2935 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2937 return (*env)->CallVoidMethod(env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
2939 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
2940 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2942 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2943 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2944 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2945 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2947 return (*env)->CallVoidMethod(env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
2949 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
2950 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2952 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2953 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2954 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2955 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2957 return (*env)->CallVoidMethod(env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
2959 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
2960 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2962 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2963 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2964 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2965 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2967 return (*env)->CallVoidMethod(env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
2969 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
2970 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2972 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2973 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2974 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2975 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2977 return (*env)->CallVoidMethod(env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
2979 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
2980 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2982 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2983 jbyteArray their_node_id_arr = (*env)->NewByteArray(env, 33);
2984 (*env)->SetByteArrayRegion(env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2985 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
2987 return (*env)->CallVoidMethod(env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
2989 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
2990 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2991 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2993 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2994 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2998 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
2999 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3000 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3001 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3002 return (void*) this_arg;
3004 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3005 jclass c = (*env)->GetObjectClass(env, o);
3007 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3008 atomic_init(&calls->refcnt, 1);
3009 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3010 calls->o = (*env)->NewWeakGlobalRef(env, o);
3011 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3012 CHECK(calls->handle_open_channel_meth != NULL);
3013 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3014 CHECK(calls->handle_accept_channel_meth != NULL);
3015 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3016 CHECK(calls->handle_funding_created_meth != NULL);
3017 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3018 CHECK(calls->handle_funding_signed_meth != NULL);
3019 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3020 CHECK(calls->handle_funding_locked_meth != NULL);
3021 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3022 CHECK(calls->handle_shutdown_meth != NULL);
3023 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3024 CHECK(calls->handle_closing_signed_meth != NULL);
3025 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3026 CHECK(calls->handle_update_add_htlc_meth != NULL);
3027 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3028 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3029 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3030 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3031 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3032 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3033 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3034 CHECK(calls->handle_commitment_signed_meth != NULL);
3035 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3036 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3037 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3038 CHECK(calls->handle_update_fee_meth != NULL);
3039 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3040 CHECK(calls->handle_announcement_signatures_meth != NULL);
3041 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3042 CHECK(calls->peer_disconnected_meth != NULL);
3043 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3044 CHECK(calls->peer_connected_meth != NULL);
3045 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3046 CHECK(calls->handle_channel_reestablish_meth != NULL);
3047 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3048 CHECK(calls->handle_error_meth != NULL);
3050 LDKChannelMessageHandler ret = {
3051 .this_arg = (void*) calls,
3052 .handle_open_channel = handle_open_channel_jcall,
3053 .handle_accept_channel = handle_accept_channel_jcall,
3054 .handle_funding_created = handle_funding_created_jcall,
3055 .handle_funding_signed = handle_funding_signed_jcall,
3056 .handle_funding_locked = handle_funding_locked_jcall,
3057 .handle_shutdown = handle_shutdown_jcall,
3058 .handle_closing_signed = handle_closing_signed_jcall,
3059 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3060 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3061 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3062 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3063 .handle_commitment_signed = handle_commitment_signed_jcall,
3064 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3065 .handle_update_fee = handle_update_fee_jcall,
3066 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3067 .peer_disconnected = peer_disconnected_jcall,
3068 .peer_connected = peer_connected_jcall,
3069 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3070 .handle_error = handle_error_jcall,
3071 .free = LDKChannelMessageHandler_JCalls_free,
3072 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3074 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3077 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3078 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3079 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3080 return (long)res_ptr;
3082 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3083 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3087 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) {
3088 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3089 LDKPublicKey their_node_id_ref;
3090 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3091 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3092 LDKInitFeatures their_features_conv;
3093 their_features_conv.inner = (void*)(their_features & (~1));
3094 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3095 // Warning: we may need a move here but can't clone!
3096 LDKOpenChannel msg_conv;
3097 msg_conv.inner = (void*)(msg & (~1));
3098 msg_conv.is_owned = (msg & 1) || (msg == 0);
3099 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3102 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) {
3103 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3104 LDKPublicKey their_node_id_ref;
3105 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3106 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3107 LDKInitFeatures their_features_conv;
3108 their_features_conv.inner = (void*)(their_features & (~1));
3109 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3110 // Warning: we may need a move here but can't clone!
3111 LDKAcceptChannel msg_conv;
3112 msg_conv.inner = (void*)(msg & (~1));
3113 msg_conv.is_owned = (msg & 1) || (msg == 0);
3114 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3117 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) {
3118 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3119 LDKPublicKey their_node_id_ref;
3120 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3121 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3122 LDKFundingCreated msg_conv;
3123 msg_conv.inner = (void*)(msg & (~1));
3124 msg_conv.is_owned = (msg & 1) || (msg == 0);
3125 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3128 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) {
3129 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3130 LDKPublicKey their_node_id_ref;
3131 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3132 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3133 LDKFundingSigned msg_conv;
3134 msg_conv.inner = (void*)(msg & (~1));
3135 msg_conv.is_owned = (msg & 1) || (msg == 0);
3136 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3139 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) {
3140 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3141 LDKPublicKey their_node_id_ref;
3142 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3143 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3144 LDKFundingLocked msg_conv;
3145 msg_conv.inner = (void*)(msg & (~1));
3146 msg_conv.is_owned = (msg & 1) || (msg == 0);
3147 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3151 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3152 LDKPublicKey their_node_id_ref;
3153 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3154 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3155 LDKShutdown msg_conv;
3156 msg_conv.inner = (void*)(msg & (~1));
3157 msg_conv.is_owned = (msg & 1) || (msg == 0);
3158 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3161 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) {
3162 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3163 LDKPublicKey their_node_id_ref;
3164 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3165 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3166 LDKClosingSigned msg_conv;
3167 msg_conv.inner = (void*)(msg & (~1));
3168 msg_conv.is_owned = (msg & 1) || (msg == 0);
3169 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3172 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) {
3173 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3174 LDKPublicKey their_node_id_ref;
3175 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3176 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3177 LDKUpdateAddHTLC msg_conv;
3178 msg_conv.inner = (void*)(msg & (~1));
3179 msg_conv.is_owned = (msg & 1) || (msg == 0);
3180 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3183 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) {
3184 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3185 LDKPublicKey their_node_id_ref;
3186 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3187 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3188 LDKUpdateFulfillHTLC msg_conv;
3189 msg_conv.inner = (void*)(msg & (~1));
3190 msg_conv.is_owned = (msg & 1) || (msg == 0);
3191 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3194 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) {
3195 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3196 LDKPublicKey their_node_id_ref;
3197 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3198 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3199 LDKUpdateFailHTLC msg_conv;
3200 msg_conv.inner = (void*)(msg & (~1));
3201 msg_conv.is_owned = (msg & 1) || (msg == 0);
3202 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3205 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) {
3206 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3207 LDKPublicKey their_node_id_ref;
3208 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3209 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3210 LDKUpdateFailMalformedHTLC msg_conv;
3211 msg_conv.inner = (void*)(msg & (~1));
3212 msg_conv.is_owned = (msg & 1) || (msg == 0);
3213 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3216 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) {
3217 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3218 LDKPublicKey their_node_id_ref;
3219 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3220 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3221 LDKCommitmentSigned msg_conv;
3222 msg_conv.inner = (void*)(msg & (~1));
3223 msg_conv.is_owned = (msg & 1) || (msg == 0);
3224 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3227 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) {
3228 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3229 LDKPublicKey their_node_id_ref;
3230 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3231 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3232 LDKRevokeAndACK msg_conv;
3233 msg_conv.inner = (void*)(msg & (~1));
3234 msg_conv.is_owned = (msg & 1) || (msg == 0);
3235 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3238 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) {
3239 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3240 LDKPublicKey their_node_id_ref;
3241 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3242 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3243 LDKUpdateFee msg_conv;
3244 msg_conv.inner = (void*)(msg & (~1));
3245 msg_conv.is_owned = (msg & 1) || (msg == 0);
3246 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3249 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) {
3250 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3251 LDKPublicKey their_node_id_ref;
3252 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3253 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3254 LDKAnnouncementSignatures msg_conv;
3255 msg_conv.inner = (void*)(msg & (~1));
3256 msg_conv.is_owned = (msg & 1) || (msg == 0);
3257 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3260 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) {
3261 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3262 LDKPublicKey their_node_id_ref;
3263 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3264 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3265 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3269 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3270 LDKPublicKey their_node_id_ref;
3271 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3272 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3274 msg_conv.inner = (void*)(msg & (~1));
3275 msg_conv.is_owned = (msg & 1) || (msg == 0);
3276 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3279 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) {
3280 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3281 LDKPublicKey their_node_id_ref;
3282 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3283 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3284 LDKChannelReestablish msg_conv;
3285 msg_conv.inner = (void*)(msg & (~1));
3286 msg_conv.is_owned = (msg & 1) || (msg == 0);
3287 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3291 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3292 LDKPublicKey their_node_id_ref;
3293 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3294 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3295 LDKErrorMessage msg_conv;
3296 msg_conv.inner = (void*)(msg & (~1));
3297 msg_conv.is_owned = (msg & 1) || (msg == 0);
3298 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3301 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3302 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3303 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3304 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3305 for (size_t i = 0; i < vec->datalen; i++) {
3306 CHECK((((long)vec->data[i].inner) & 1) == 0);
3307 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3309 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3313 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3314 ret->datalen = (*env)->GetArrayLength(env, elems);
3315 if (ret->datalen == 0) {
3318 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3319 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3320 for (size_t i = 0; i < ret->datalen; i++) {
3321 jlong arr_elem = java_elems[i];
3322 LDKChannelMonitor arr_elem_conv;
3323 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3324 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3325 // Warning: we may need a move here but can't clone!
3326 ret->data[i] = arr_elem_conv;
3328 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3332 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3333 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3334 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3337 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3338 ret->datalen = (*env)->GetArrayLength(env, elems);
3339 if (ret->datalen == 0) {
3342 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3343 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3344 for (size_t i = 0; i < ret->datalen; i++) {
3345 ret->data[i] = java_elems[i];
3347 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3351 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3352 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3353 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3354 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3355 for (size_t i = 0; i < vec->datalen; i++) {
3356 CHECK((((long)vec->data[i].inner) & 1) == 0);
3357 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3359 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3363 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3364 ret->datalen = (*env)->GetArrayLength(env, elems);
3365 if (ret->datalen == 0) {
3368 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3369 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3370 for (size_t i = 0; i < ret->datalen; i++) {
3371 jlong arr_elem = java_elems[i];
3372 LDKUpdateAddHTLC arr_elem_conv;
3373 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3374 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3375 if (arr_elem_conv.inner != NULL)
3376 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3377 ret->data[i] = arr_elem_conv;
3379 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3383 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3384 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3385 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3386 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3387 for (size_t i = 0; i < vec->datalen; i++) {
3388 CHECK((((long)vec->data[i].inner) & 1) == 0);
3389 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3391 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3395 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3396 ret->datalen = (*env)->GetArrayLength(env, elems);
3397 if (ret->datalen == 0) {
3400 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3401 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3402 for (size_t i = 0; i < ret->datalen; i++) {
3403 jlong arr_elem = java_elems[i];
3404 LDKUpdateFulfillHTLC arr_elem_conv;
3405 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3406 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3407 if (arr_elem_conv.inner != NULL)
3408 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3409 ret->data[i] = arr_elem_conv;
3411 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3415 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3416 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3417 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3418 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3419 for (size_t i = 0; i < vec->datalen; i++) {
3420 CHECK((((long)vec->data[i].inner) & 1) == 0);
3421 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3423 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3427 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3428 ret->datalen = (*env)->GetArrayLength(env, elems);
3429 if (ret->datalen == 0) {
3432 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3433 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3434 for (size_t i = 0; i < ret->datalen; i++) {
3435 jlong arr_elem = java_elems[i];
3436 LDKUpdateFailHTLC arr_elem_conv;
3437 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3438 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3439 if (arr_elem_conv.inner != NULL)
3440 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3441 ret->data[i] = arr_elem_conv;
3443 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3447 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3448 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3449 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3450 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3451 for (size_t i = 0; i < vec->datalen; i++) {
3452 CHECK((((long)vec->data[i].inner) & 1) == 0);
3453 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3455 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3459 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3460 ret->datalen = (*env)->GetArrayLength(env, elems);
3461 if (ret->datalen == 0) {
3464 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3465 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3466 for (size_t i = 0; i < ret->datalen; i++) {
3467 jlong arr_elem = java_elems[i];
3468 LDKUpdateFailMalformedHTLC arr_elem_conv;
3469 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3470 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3471 if (arr_elem_conv.inner != NULL)
3472 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3473 ret->data[i] = arr_elem_conv;
3475 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3479 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3480 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3483 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3484 if (val->result_ok) {
3485 return (long)val->contents.result;
3487 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3490 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3491 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3492 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3495 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3496 ret->datalen = (*env)->GetArrayLength(env, elems);
3497 if (ret->datalen == 0) {
3500 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3501 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3502 for (size_t i = 0; i < ret->datalen; i++) {
3503 jlong arr_elem = java_elems[i];
3504 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3505 FREE((void*)arr_elem);
3506 ret->data[i] = arr_elem_conv;
3508 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3512 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3513 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3514 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3515 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3516 for (size_t i = 0; i < vec->datalen; i++) {
3517 CHECK((((long)vec->data[i].inner) & 1) == 0);
3518 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3520 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3523 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3524 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3525 ret->datalen = (*env)->GetArrayLength(env, elems);
3526 if (ret->datalen == 0) {
3529 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3530 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3531 for (size_t i = 0; i < ret->datalen; i++) {
3532 jlong arr_elem = java_elems[i];
3533 LDKNodeAnnouncement arr_elem_conv;
3534 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3535 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3536 if (arr_elem_conv.inner != NULL)
3537 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3538 ret->data[i] = arr_elem_conv;
3540 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3544 typedef struct LDKRoutingMessageHandler_JCalls {
3545 atomic_size_t refcnt;
3548 jmethodID handle_node_announcement_meth;
3549 jmethodID handle_channel_announcement_meth;
3550 jmethodID handle_channel_update_meth;
3551 jmethodID handle_htlc_fail_channel_update_meth;
3552 jmethodID get_next_channel_announcements_meth;
3553 jmethodID get_next_node_announcements_meth;
3554 jmethodID should_request_full_sync_meth;
3555 } LDKRoutingMessageHandler_JCalls;
3556 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3557 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3559 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3560 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3562 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_node_announcement_meth, msg);
3563 LDKCResult_boolLightningErrorZ res = *ret;
3567 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3568 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3570 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3571 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3573 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_announcement_meth, msg);
3574 LDKCResult_boolLightningErrorZ res = *ret;
3578 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3579 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3581 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3582 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3584 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*env)->CallLongMethod(env, obj, j_calls->handle_channel_update_meth, msg);
3585 LDKCResult_boolLightningErrorZ res = *ret;
3589 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3590 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3592 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3593 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3595 return (*env)->CallVoidMethod(env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3597 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3598 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3600 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3601 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3603 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3604 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
3608 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3609 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3611 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3612 jbyteArray starting_point_arr = (*env)->NewByteArray(env, 33);
3613 (*env)->SetByteArrayRegion(env, starting_point_arr, 0, 33, starting_point.compressed_form);
3614 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3616 LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*env)->CallLongMethod(env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3617 LDKCVec_NodeAnnouncementZ res = *ret;
3621 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3622 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3624 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3625 jbyteArray node_id_arr = (*env)->NewByteArray(env, 33);
3626 (*env)->SetByteArrayRegion(env, node_id_arr, 0, 33, node_id.compressed_form);
3627 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3629 return (*env)->CallBooleanMethod(env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3631 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3632 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3633 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3635 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3636 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3640 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3641 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3642 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3643 return (void*) this_arg;
3645 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3646 jclass c = (*env)->GetObjectClass(env, o);
3648 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3649 atomic_init(&calls->refcnt, 1);
3650 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3651 calls->o = (*env)->NewWeakGlobalRef(env, o);
3652 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3653 CHECK(calls->handle_node_announcement_meth != NULL);
3654 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3655 CHECK(calls->handle_channel_announcement_meth != NULL);
3656 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3657 CHECK(calls->handle_channel_update_meth != NULL);
3658 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3659 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3660 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
3661 CHECK(calls->get_next_channel_announcements_meth != NULL);
3662 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)J");
3663 CHECK(calls->get_next_node_announcements_meth != NULL);
3664 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3665 CHECK(calls->should_request_full_sync_meth != NULL);
3667 LDKRoutingMessageHandler ret = {
3668 .this_arg = (void*) calls,
3669 .handle_node_announcement = handle_node_announcement_jcall,
3670 .handle_channel_announcement = handle_channel_announcement_jcall,
3671 .handle_channel_update = handle_channel_update_jcall,
3672 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3673 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3674 .get_next_node_announcements = get_next_node_announcements_jcall,
3675 .should_request_full_sync = should_request_full_sync_jcall,
3676 .free = LDKRoutingMessageHandler_JCalls_free,
3680 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3681 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3682 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3683 return (long)res_ptr;
3685 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3686 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3690 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3691 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3692 LDKNodeAnnouncement msg_conv;
3693 msg_conv.inner = (void*)(msg & (~1));
3694 msg_conv.is_owned = (msg & 1) || (msg == 0);
3695 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3696 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3701 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3702 LDKChannelAnnouncement msg_conv;
3703 msg_conv.inner = (void*)(msg & (~1));
3704 msg_conv.is_owned = (msg & 1) || (msg == 0);
3705 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3706 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3711 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3712 LDKChannelUpdate msg_conv;
3713 msg_conv.inner = (void*)(msg & (~1));
3714 msg_conv.is_owned = (msg & 1) || (msg == 0);
3715 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3716 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3721 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3722 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3723 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3726 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) {
3727 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3728 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = MALLOC(sizeof(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ");
3729 *ret = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3733 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) {
3734 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3735 LDKPublicKey starting_point_ref;
3736 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3737 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3738 LDKCVec_NodeAnnouncementZ* ret = MALLOC(sizeof(LDKCVec_NodeAnnouncementZ), "LDKCVec_NodeAnnouncementZ");
3739 *ret = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3743 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
3744 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3745 LDKPublicKey node_id_ref;
3746 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
3747 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
3748 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
3752 typedef struct LDKSocketDescriptor_JCalls {
3753 atomic_size_t refcnt;
3756 jmethodID send_data_meth;
3757 jmethodID disconnect_socket_meth;
3759 jmethodID hash_meth;
3760 } LDKSocketDescriptor_JCalls;
3761 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
3762 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3764 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3765 LDKu8slice data_var = data;
3766 jbyteArray data_arr = (*env)->NewByteArray(env, data_var.datalen);
3767 (*env)->SetByteArrayRegion(env, data_arr, 0, data_var.datalen, data_var.data);
3768 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3770 return (*env)->CallLongMethod(env, obj, j_calls->send_data_meth, data_arr, resume_read);
3772 void disconnect_socket_jcall(void* this_arg) {
3773 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3775 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3776 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3778 return (*env)->CallVoidMethod(env, obj, j_calls->disconnect_socket_meth);
3780 bool eq_jcall(const void* this_arg, const void *other_arg) {
3781 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3783 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3784 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3786 return (*env)->CallBooleanMethod(env, obj, j_calls->eq_meth, other_arg);
3788 uint64_t hash_jcall(const void* this_arg) {
3789 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3791 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3792 jobject obj = (*env)->NewLocalRef(env, j_calls->o);
3794 return (*env)->CallLongMethod(env, obj, j_calls->hash_meth);
3796 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
3797 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3798 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3800 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3801 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3805 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
3806 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
3807 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3808 return (void*) this_arg;
3810 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
3811 jclass c = (*env)->GetObjectClass(env, o);
3813 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
3814 atomic_init(&calls->refcnt, 1);
3815 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3816 calls->o = (*env)->NewWeakGlobalRef(env, o);
3817 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
3818 CHECK(calls->send_data_meth != NULL);
3819 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
3820 CHECK(calls->disconnect_socket_meth != NULL);
3821 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
3822 CHECK(calls->eq_meth != NULL);
3823 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
3824 CHECK(calls->hash_meth != NULL);
3826 LDKSocketDescriptor ret = {
3827 .this_arg = (void*) calls,
3828 .send_data = send_data_jcall,
3829 .disconnect_socket = disconnect_socket_jcall,
3832 .clone = LDKSocketDescriptor_JCalls_clone,
3833 .free = LDKSocketDescriptor_JCalls_free,
3837 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
3838 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
3839 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
3840 return (long)res_ptr;
3842 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3843 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
3847 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
3848 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3849 LDKu8slice data_ref;
3850 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
3851 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
3852 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
3853 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
3857 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
3858 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3859 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
3862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
3863 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
3864 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
3868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3869 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
3870 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
3872 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3873 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
3875 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3876 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
3877 if (val->result_ok) {
3878 return (long)val->contents.result;
3880 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3883 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3884 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
3886 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3887 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
3888 if (val->result_ok) {
3889 return (long)val->contents.result;
3891 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
3894 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3895 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
3897 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3898 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
3899 if (val->result_ok) {
3900 return (long)val->contents.result;
3902 return (long)val->contents.err;
3905 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3906 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
3908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3909 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
3910 if (val->result_ok) {
3911 return (long)val->contents.result;
3913 return (long)val->contents.err;
3916 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3917 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
3919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
3920 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
3921 if (val->result_ok) {
3922 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
3924 return (long)val->contents.err;
3927 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3928 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
3929 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
3931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
3932 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
3933 ret->datalen = (*env)->GetArrayLength(env, elems);
3934 if (ret->datalen == 0) {
3937 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
3938 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3939 for (size_t i = 0; i < ret->datalen; i++) {
3940 jlong arr_elem = java_elems[i];
3941 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
3942 FREE((void*)arr_elem);
3943 ret->data[i] = arr_elem_conv;
3945 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3949 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3950 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
3951 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3952 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3953 for (size_t i = 0; i < vec->datalen; i++) {
3954 CHECK((((long)vec->data[i].inner) & 1) == 0);
3955 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3957 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3961 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
3962 ret->datalen = (*env)->GetArrayLength(env, elems);
3963 if (ret->datalen == 0) {
3966 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
3967 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3968 for (size_t i = 0; i < ret->datalen; i++) {
3969 jlong arr_elem = java_elems[i];
3970 LDKRouteHop arr_elem_conv;
3971 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3972 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3973 if (arr_elem_conv.inner != NULL)
3974 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
3975 ret->data[i] = arr_elem_conv;
3977 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3981 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3982 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
3983 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
3985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
3986 LDKCVecTempl_CVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_CVecTempl_RouteHop), "LDKCVecTempl_CVecTempl_RouteHop");
3987 ret->datalen = (*env)->GetArrayLength(env, elems);
3988 if (ret->datalen == 0) {
3991 ret->data = MALLOC(sizeof(LDKCVecTempl_RouteHop) * ret->datalen, "LDKCVecTempl_CVecTempl_RouteHop Data");
3992 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3993 for (size_t i = 0; i < ret->datalen; i++) {
3994 jlong arr_elem = java_elems[i];
3995 LDKCVecTempl_RouteHop arr_elem_conv = *(LDKCVecTempl_RouteHop*)arr_elem;
3996 FREE((void*)arr_elem);
3997 ret->data[i] = arr_elem_conv;
3999 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4003 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4004 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1inner (JNIEnv * env, jclass _a, jlong arg) {
4007 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4008 if (val->result_ok) {
4009 return (long)(val->contents.result->inner) | (val->contents.result->is_owned ? 1 : 0);
4011 return (long)(val->contents.err->inner) | (val->contents.err->is_owned ? 1 : 0);
4014 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4015 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4016 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4017 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4018 for (size_t i = 0; i < vec->datalen; i++) {
4019 CHECK((((long)vec->data[i].inner) & 1) == 0);
4020 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4022 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4026 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4027 ret->datalen = (*env)->GetArrayLength(env, elems);
4028 if (ret->datalen == 0) {
4031 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4032 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4033 for (size_t i = 0; i < ret->datalen; i++) {
4034 jlong arr_elem = java_elems[i];
4035 LDKRouteHint arr_elem_conv;
4036 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4037 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4038 if (arr_elem_conv.inner != NULL)
4039 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4040 ret->data[i] = arr_elem_conv;
4042 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4046 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4047 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4049 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4052 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4053 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4055 C2Tuple_OutPointScriptZ_free(arg_conv);
4058 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4059 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4061 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4064 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4065 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4067 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4071 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4073 C2Tuple_u64u64Z_free(arg_conv);
4076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4077 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4079 C2Tuple_usizeTransactionZ_free(arg_conv);
4082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4083 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4085 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4088 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4089 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4091 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4095 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4097 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4098 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4102 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4103 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4105 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4109 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4111 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4112 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
4116 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4117 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4119 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4120 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4125 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4127 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4130 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4131 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4133 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4134 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
4138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4139 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4141 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4142 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4147 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4149 CResult_NoneAPIErrorZ_free(arg_conv);
4152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4153 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4155 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4156 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4160 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4161 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4163 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4167 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4169 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4170 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4174 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4175 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4177 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4181 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4183 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4184 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4189 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4191 CResult_NonePaymentSendFailureZ_free(arg_conv);
4194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4195 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4197 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4198 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4203 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4205 CResult_NonePeerHandleErrorZ_free(arg_conv);
4208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4209 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4211 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4212 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4216 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4217 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4219 CResult_PublicKeySecpErrorZ_free(arg_conv);
4222 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4223 LDKPublicKey arg_ref;
4224 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4225 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4226 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4227 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4232 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4234 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4235 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4239 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4240 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4242 CResult_RouteLightningErrorZ_free(arg_conv);
4245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4246 LDKRoute arg_conv = *(LDKRoute*)arg;
4248 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4249 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4254 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4256 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4257 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4261 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4262 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4264 CResult_SecretKeySecpErrorZ_free(arg_conv);
4267 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4268 LDKSecretKey arg_ref;
4269 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4270 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4271 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4272 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4277 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4279 CResult_SignatureNoneZ_free(arg_conv);
4282 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4283 LDKSignature arg_ref;
4284 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4285 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4286 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4287 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4292 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4294 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4295 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4300 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4302 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4306 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4308 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4309 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4314 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4316 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4317 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4322 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4324 CResult_TxOutAccessErrorZ_free(arg_conv);
4327 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4328 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4330 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4331 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4336 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4338 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4339 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4343 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4344 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4346 CResult_boolLightningErrorZ_free(arg_conv);
4349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4350 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4351 *ret = CResult_boolLightningErrorZ_ok(arg);
4355 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4356 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4358 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4359 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4364 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4366 CResult_boolPeerHandleErrorZ_free(arg_conv);
4369 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4370 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4371 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4375 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4376 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
4378 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
4381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4382 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_conv = *(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ*)arg;
4384 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_conv);
4387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4388 LDKCVec_C2Tuple_usizeTransactionZZ arg_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)arg;
4390 CVec_C2Tuple_usizeTransactionZZ_free(arg_conv);
4393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4394 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
4396 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
4399 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4400 LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
4402 CVec_CVec_RouteHopZZ_free(arg_conv);
4405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4406 LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
4408 CVec_ChannelDetailsZ_free(arg_conv);
4411 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4412 LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
4414 CVec_ChannelMonitorZ_free(arg_conv);
4417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4418 LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
4420 CVec_EventZ_free(arg_conv);
4423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4424 LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
4426 CVec_HTLCOutputInCommitmentZ_free(arg_conv);
4429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4430 LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
4432 CVec_MessageSendEventZ_free(arg_conv);
4435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4436 LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
4438 CVec_MonitorEventZ_free(arg_conv);
4441 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4442 LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
4444 CVec_NetAddressZ_free(arg_conv);
4447 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4448 LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
4450 CVec_NodeAnnouncementZ_free(arg_conv);
4453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4454 LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
4456 CVec_PublicKeyZ_free(arg_conv);
4459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4460 LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
4462 CVec_RouteHintZ_free(arg_conv);
4465 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4466 LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
4468 CVec_RouteHopZ_free(arg_conv);
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4472 LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
4474 CVec_SignatureZ_free(arg_conv);
4477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4478 LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
4480 CVec_SpendableOutputDescriptorZ_free(arg_conv);
4483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4484 LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
4486 CVec_TransactionZ_free(arg_conv);
4489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4490 LDKCVec_TxOutZ arg_conv = *(LDKCVec_TxOutZ*)arg;
4492 CVec_TxOutZ_free(arg_conv);
4495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4496 LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
4498 CVec_UpdateAddHTLCZ_free(arg_conv);
4501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4502 LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
4504 CVec_UpdateFailHTLCZ_free(arg_conv);
4507 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4508 LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
4510 CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
4513 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4514 LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
4516 CVec_UpdateFulfillHTLCZ_free(arg_conv);
4519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4520 LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
4522 CVec_u64Z_free(arg_conv);
4525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4526 LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
4528 CVec_u8Z_free(arg_conv);
4531 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
4532 LDKTransaction _res_conv = *(LDKTransaction*)_res;
4534 Transaction_free(_res_conv);
4537 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
4538 LDKTxOut _res_conv = *(LDKTxOut*)_res;
4540 TxOut_free(_res_conv);
4543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4544 LDKTransaction b_conv = *(LDKTransaction*)b;
4546 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
4547 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
4551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
4552 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4553 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
4557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
4558 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4559 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
4563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4565 a_conv.inner = (void*)(a & (~1));
4566 a_conv.is_owned = (a & 1) || (a == 0);
4567 if (a_conv.inner != NULL)
4568 a_conv = OutPoint_clone(&a_conv);
4569 LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
4571 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
4572 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
4576 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4577 LDKThirtyTwoBytes a_ref;
4578 CHECK((*_env)->GetArrayLength (_env, a) == 32);
4579 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
4580 LDKCVec_TxOutZ b_conv = *(LDKCVec_TxOutZ*)b;
4582 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
4583 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_conv);
4587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
4588 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
4589 *ret = C2Tuple_u64u64Z_new(a, b);
4593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlong b) {
4595 CHECK((*_env)->GetArrayLength (_env, a) == 64);
4596 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
4597 LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
4599 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
4600 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_conv);
4604 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
4605 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4606 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
4610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
4611 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4612 *ret = CResult_SignatureNoneZ_err();
4616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
4617 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4618 *ret = CResult_CVec_SignatureZNoneZ_err();
4622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
4623 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4624 *ret = CResult_NoneAPIErrorZ_ok();
4628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
4629 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4630 *ret = CResult_NonePaymentSendFailureZ_ok();
4634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
4635 LDKChannelAnnouncement a_conv;
4636 a_conv.inner = (void*)(a & (~1));
4637 a_conv.is_owned = (a & 1) || (a == 0);
4638 if (a_conv.inner != NULL)
4639 a_conv = ChannelAnnouncement_clone(&a_conv);
4640 LDKChannelUpdate b_conv;
4641 b_conv.inner = (void*)(b & (~1));
4642 b_conv.is_owned = (b & 1) || (b == 0);
4643 if (b_conv.inner != NULL)
4644 b_conv = ChannelUpdate_clone(&b_conv);
4645 LDKChannelUpdate c_conv;
4646 c_conv.inner = (void*)(c & (~1));
4647 c_conv.is_owned = (c & 1) || (c == 0);
4648 if (c_conv.inner != NULL)
4649 c_conv = ChannelUpdate_clone(&c_conv);
4650 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
4651 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
4655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
4656 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4657 *ret = CResult_NonePeerHandleErrorZ_ok();
4661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
4662 LDKHTLCOutputInCommitment a_conv;
4663 a_conv.inner = (void*)(a & (~1));
4664 a_conv.is_owned = (a & 1) || (a == 0);
4665 if (a_conv.inner != NULL)
4666 a_conv = HTLCOutputInCommitment_clone(&a_conv);
4668 CHECK((*_env)->GetArrayLength (_env, b) == 64);
4669 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
4670 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
4671 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
4675 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4676 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
4677 FREE((void*)this_ptr);
4678 Event_free(this_ptr_conv);
4681 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4682 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
4683 FREE((void*)this_ptr);
4684 MessageSendEvent_free(this_ptr_conv);
4687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4688 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
4689 FREE((void*)this_ptr);
4690 MessageSendEventsProvider_free(this_ptr_conv);
4693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4694 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
4695 FREE((void*)this_ptr);
4696 EventsProvider_free(this_ptr_conv);
4699 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4700 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
4701 FREE((void*)this_ptr);
4702 APIError_free(this_ptr_conv);
4705 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
4706 jclass ret = LDKLevel_to_java(_env, Level_max());
4710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4711 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
4712 FREE((void*)this_ptr);
4713 Logger_free(this_ptr_conv);
4716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4717 LDKChannelHandshakeConfig this_ptr_conv;
4718 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4719 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4720 ChannelHandshakeConfig_free(this_ptr_conv);
4723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4724 LDKChannelHandshakeConfig orig_conv;
4725 orig_conv.inner = (void*)(orig & (~1));
4726 orig_conv.is_owned = (orig & 1) || (orig == 0);
4727 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
4728 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4731 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4732 LDKChannelHandshakeConfig this_ptr_conv;
4733 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4734 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4735 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
4739 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4740 LDKChannelHandshakeConfig this_ptr_conv;
4741 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4742 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4743 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
4746 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4747 LDKChannelHandshakeConfig this_ptr_conv;
4748 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4749 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4750 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
4754 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4755 LDKChannelHandshakeConfig this_ptr_conv;
4756 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4757 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4758 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
4761 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4762 LDKChannelHandshakeConfig this_ptr_conv;
4763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4765 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
4769 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4770 LDKChannelHandshakeConfig this_ptr_conv;
4771 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4772 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4773 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
4776 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) {
4777 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
4778 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
4782 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
4783 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4787 LDKChannelHandshakeLimits this_ptr_conv;
4788 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4789 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4790 ChannelHandshakeLimits_free(this_ptr_conv);
4793 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4794 LDKChannelHandshakeLimits orig_conv;
4795 orig_conv.inner = (void*)(orig & (~1));
4796 orig_conv.is_owned = (orig & 1) || (orig == 0);
4797 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
4798 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4802 LDKChannelHandshakeLimits this_ptr_conv;
4803 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4804 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4805 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
4809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4810 LDKChannelHandshakeLimits this_ptr_conv;
4811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4813 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
4816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4817 LDKChannelHandshakeLimits this_ptr_conv;
4818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4820 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
4824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4825 LDKChannelHandshakeLimits this_ptr_conv;
4826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4828 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
4831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4832 LDKChannelHandshakeLimits this_ptr_conv;
4833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4835 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
4839 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) {
4840 LDKChannelHandshakeLimits this_ptr_conv;
4841 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4842 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4843 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
4846 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4847 LDKChannelHandshakeLimits this_ptr_conv;
4848 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4849 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4850 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
4854 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4855 LDKChannelHandshakeLimits this_ptr_conv;
4856 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4857 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4858 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
4861 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
4862 LDKChannelHandshakeLimits this_ptr_conv;
4863 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4864 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4865 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
4869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4870 LDKChannelHandshakeLimits this_ptr_conv;
4871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4873 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
4876 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4877 LDKChannelHandshakeLimits this_ptr_conv;
4878 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4879 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4880 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
4884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4885 LDKChannelHandshakeLimits this_ptr_conv;
4886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4888 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
4891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
4892 LDKChannelHandshakeLimits this_ptr_conv;
4893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4895 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
4899 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4900 LDKChannelHandshakeLimits this_ptr_conv;
4901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4903 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
4906 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
4907 LDKChannelHandshakeLimits this_ptr_conv;
4908 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4909 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4910 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
4914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4915 LDKChannelHandshakeLimits this_ptr_conv;
4916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4918 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
4921 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
4922 LDKChannelHandshakeLimits this_ptr_conv;
4923 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4924 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4925 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
4929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
4930 LDKChannelHandshakeLimits this_ptr_conv;
4931 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4932 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4933 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
4936 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
4937 LDKChannelHandshakeLimits this_ptr_conv;
4938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4940 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
4944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4945 LDKChannelHandshakeLimits this_ptr_conv;
4946 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4947 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4948 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
4951 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) {
4952 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);
4953 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
4957 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
4958 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4961 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4962 LDKChannelConfig this_ptr_conv;
4963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4965 ChannelConfig_free(this_ptr_conv);
4968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
4969 LDKChannelConfig orig_conv;
4970 orig_conv.inner = (void*)(orig & (~1));
4971 orig_conv.is_owned = (orig & 1) || (orig == 0);
4972 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
4973 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
4976 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4977 LDKChannelConfig this_ptr_conv;
4978 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4979 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4980 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
4984 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4985 LDKChannelConfig this_ptr_conv;
4986 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4987 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4988 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
4991 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
4992 LDKChannelConfig this_ptr_conv;
4993 this_ptr_conv.inner = (void*)(this_ptr & (~1));
4994 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
4995 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
4999 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5000 LDKChannelConfig this_ptr_conv;
5001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5003 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5006 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5007 LDKChannelConfig this_ptr_conv;
5008 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5009 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5010 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5015 LDKChannelConfig this_ptr_conv;
5016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5018 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5021 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) {
5022 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5023 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5026 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5027 LDKChannelConfig ret = ChannelConfig_default();
5028 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5031 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5032 LDKChannelConfig obj_conv;
5033 obj_conv.inner = (void*)(obj & (~1));
5034 obj_conv.is_owned = (obj & 1) || (obj == 0);
5035 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5036 *ret = ChannelConfig_write(&obj_conv);
5040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5042 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5043 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5044 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5045 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5046 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5049 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5050 LDKUserConfig this_ptr_conv;
5051 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5052 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5053 UserConfig_free(this_ptr_conv);
5056 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5057 LDKUserConfig orig_conv;
5058 orig_conv.inner = (void*)(orig & (~1));
5059 orig_conv.is_owned = (orig & 1) || (orig == 0);
5060 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5061 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5065 LDKUserConfig this_ptr_conv;
5066 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5067 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5068 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5069 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5072 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5073 LDKUserConfig 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 LDKChannelHandshakeConfig val_conv;
5077 val_conv.inner = (void*)(val & (~1));
5078 val_conv.is_owned = (val & 1) || (val == 0);
5079 if (val_conv.inner != NULL)
5080 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5081 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5084 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5085 LDKUserConfig this_ptr_conv;
5086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5088 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5089 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5092 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5093 LDKUserConfig this_ptr_conv;
5094 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5095 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5096 LDKChannelHandshakeLimits val_conv;
5097 val_conv.inner = (void*)(val & (~1));
5098 val_conv.is_owned = (val & 1) || (val == 0);
5099 if (val_conv.inner != NULL)
5100 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5101 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5104 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5105 LDKUserConfig this_ptr_conv;
5106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5108 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5109 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5112 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5113 LDKUserConfig this_ptr_conv;
5114 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5115 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5116 LDKChannelConfig val_conv;
5117 val_conv.inner = (void*)(val & (~1));
5118 val_conv.is_owned = (val & 1) || (val == 0);
5119 if (val_conv.inner != NULL)
5120 val_conv = ChannelConfig_clone(&val_conv);
5121 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5124 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) {
5125 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5126 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5127 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5128 if (own_channel_config_arg_conv.inner != NULL)
5129 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5130 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5131 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5132 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5133 if (peer_channel_config_limits_arg_conv.inner != NULL)
5134 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5135 LDKChannelConfig channel_options_arg_conv;
5136 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5137 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5138 if (channel_options_arg_conv.inner != NULL)
5139 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5140 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5141 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5145 LDKUserConfig ret = UserConfig_default();
5146 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5149 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5150 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5151 FREE((void*)this_ptr);
5152 Access_free(this_ptr_conv);
5155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5156 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5157 FREE((void*)this_ptr);
5158 Watch_free(this_ptr_conv);
5161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5162 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5163 FREE((void*)this_ptr);
5164 Filter_free(this_ptr_conv);
5167 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5168 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5169 FREE((void*)this_ptr);
5170 BroadcasterInterface_free(this_ptr_conv);
5173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5174 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5175 FREE((void*)this_ptr);
5176 FeeEstimator_free(this_ptr_conv);
5179 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5180 LDKChainMonitor this_ptr_conv;
5181 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5182 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5183 ChainMonitor_free(this_ptr_conv);
5186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
5187 LDKChainMonitor this_arg_conv;
5188 this_arg_conv.inner = (void*)(this_arg & (~1));
5189 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5190 unsigned char header_arr[80];
5191 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5192 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5193 unsigned char (*header_ref)[80] = &header_arr;
5194 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5195 FREE((void*)txdata);
5196 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
5199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5200 LDKChainMonitor this_arg_conv;
5201 this_arg_conv.inner = (void*)(this_arg & (~1));
5202 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5203 unsigned char header_arr[80];
5204 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5205 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5206 unsigned char (*header_ref)[80] = &header_arr;
5207 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5211 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5212 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5213 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5214 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5215 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5217 LDKLogger logger_conv = *(LDKLogger*)logger;
5218 if (logger_conv.free == LDKLogger_JCalls_free) {
5219 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5220 LDKLogger_JCalls_clone(logger_conv.this_arg);
5222 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5223 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5224 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5225 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5227 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5228 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5231 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5232 LDKChainMonitor this_arg_conv;
5233 this_arg_conv.inner = (void*)(this_arg & (~1));
5234 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5235 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5236 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5241 LDKChainMonitor this_arg_conv;
5242 this_arg_conv.inner = (void*)(this_arg & (~1));
5243 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5244 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5245 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5250 LDKChannelMonitorUpdate this_ptr_conv;
5251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5253 ChannelMonitorUpdate_free(this_ptr_conv);
5256 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5257 LDKChannelMonitorUpdate orig_conv;
5258 orig_conv.inner = (void*)(orig & (~1));
5259 orig_conv.is_owned = (orig & 1) || (orig == 0);
5260 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5261 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5265 LDKChannelMonitorUpdate this_ptr_conv;
5266 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5267 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5268 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5272 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5273 LDKChannelMonitorUpdate this_ptr_conv;
5274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5276 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5280 LDKChannelMonitorUpdate obj_conv;
5281 obj_conv.inner = (void*)(obj & (~1));
5282 obj_conv.is_owned = (obj & 1) || (obj == 0);
5283 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5284 *ret = ChannelMonitorUpdate_write(&obj_conv);
5288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5290 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5291 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5292 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5293 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5294 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5297 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5298 LDKMonitorUpdateError this_ptr_conv;
5299 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5300 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5301 MonitorUpdateError_free(this_ptr_conv);
5304 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5305 LDKMonitorEvent this_ptr_conv;
5306 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5307 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5308 MonitorEvent_free(this_ptr_conv);
5311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5312 LDKHTLCUpdate this_ptr_conv;
5313 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5314 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5315 HTLCUpdate_free(this_ptr_conv);
5318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5319 LDKHTLCUpdate orig_conv;
5320 orig_conv.inner = (void*)(orig & (~1));
5321 orig_conv.is_owned = (orig & 1) || (orig == 0);
5322 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
5323 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5327 LDKHTLCUpdate obj_conv;
5328 obj_conv.inner = (void*)(obj & (~1));
5329 obj_conv.is_owned = (obj & 1) || (obj == 0);
5330 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5331 *ret = HTLCUpdate_write(&obj_conv);
5335 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5337 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5338 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5339 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
5340 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5341 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5345 LDKChannelMonitor this_ptr_conv;
5346 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5347 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5348 ChannelMonitor_free(this_ptr_conv);
5351 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
5352 LDKChannelMonitor this_arg_conv;
5353 this_arg_conv.inner = (void*)(this_arg & (~1));
5354 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5355 LDKChannelMonitorUpdate updates_conv;
5356 updates_conv.inner = (void*)(updates & (~1));
5357 updates_conv.is_owned = (updates & 1) || (updates == 0);
5358 if (updates_conv.inner != NULL)
5359 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
5360 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
5361 LDKLogger* logger_conv = (LDKLogger*)logger;
5362 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5363 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
5367 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5368 LDKChannelMonitor this_arg_conv;
5369 this_arg_conv.inner = (void*)(this_arg & (~1));
5370 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5371 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
5375 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
5376 LDKChannelMonitor this_arg_conv;
5377 this_arg_conv.inner = (void*)(this_arg & (~1));
5378 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5379 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5380 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
5384 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5385 LDKChannelMonitor this_arg_conv;
5386 this_arg_conv.inner = (void*)(this_arg & (~1));
5387 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5388 LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
5389 *ret = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
5393 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5394 LDKChannelMonitor this_arg_conv;
5395 this_arg_conv.inner = (void*)(this_arg & (~1));
5396 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5397 LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
5398 *ret = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
5402 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
5403 LDKChannelMonitor this_arg_conv;
5404 this_arg_conv.inner = (void*)(this_arg & (~1));
5405 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5406 LDKLogger* logger_conv = (LDKLogger*)logger;
5407 LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
5408 *ret = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
5412 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) {
5413 LDKChannelMonitor this_arg_conv;
5414 this_arg_conv.inner = (void*)(this_arg & (~1));
5415 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5416 unsigned char header_arr[80];
5417 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5418 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5419 unsigned char (*header_ref)[80] = &header_arr;
5420 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
5421 FREE((void*)txdata);
5422 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5423 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5424 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5425 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5427 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5428 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5429 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5430 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5432 LDKLogger logger_conv = *(LDKLogger*)logger;
5433 if (logger_conv.free == LDKLogger_JCalls_free) {
5434 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5435 LDKLogger_JCalls_clone(logger_conv.this_arg);
5437 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ* ret = MALLOC(sizeof(LDKCVec_C2Tuple_TxidCVec_TxOutZZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ");
5438 *ret = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_conv, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5442 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) {
5443 LDKChannelMonitor this_arg_conv;
5444 this_arg_conv.inner = (void*)(this_arg & (~1));
5445 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5446 unsigned char header_arr[80];
5447 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5448 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5449 unsigned char (*header_ref)[80] = &header_arr;
5450 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5451 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5452 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5453 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5455 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
5456 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
5457 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5458 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
5460 LDKLogger logger_conv = *(LDKLogger*)logger;
5461 if (logger_conv.free == LDKLogger_JCalls_free) {
5462 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5463 LDKLogger_JCalls_clone(logger_conv.this_arg);
5465 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
5468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5469 LDKOutPoint this_ptr_conv;
5470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5472 OutPoint_free(this_ptr_conv);
5475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5476 LDKOutPoint orig_conv;
5477 orig_conv.inner = (void*)(orig & (~1));
5478 orig_conv.is_owned = (orig & 1) || (orig == 0);
5479 LDKOutPoint ret = OutPoint_clone(&orig_conv);
5480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
5484 LDKOutPoint this_ptr_conv;
5485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5487 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5488 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
5492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5493 LDKOutPoint this_ptr_conv;
5494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5496 LDKThirtyTwoBytes val_ref;
5497 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5498 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5499 OutPoint_set_txid(&this_ptr_conv, val_ref);
5502 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
5503 LDKOutPoint this_ptr_conv;
5504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5506 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
5510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5511 LDKOutPoint this_ptr_conv;
5512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5514 OutPoint_set_index(&this_ptr_conv, val);
5517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
5518 LDKThirtyTwoBytes txid_arg_ref;
5519 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
5520 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
5521 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
5522 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5525 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
5526 LDKOutPoint this_arg_conv;
5527 this_arg_conv.inner = (void*)(this_arg & (~1));
5528 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5529 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
5530 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
5534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
5535 LDKOutPoint obj_conv;
5536 obj_conv.inner = (void*)(obj & (~1));
5537 obj_conv.is_owned = (obj & 1) || (obj == 0);
5538 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5539 *ret = OutPoint_write(&obj_conv);
5543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5545 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5546 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5547 LDKOutPoint ret = OutPoint_read(ser_ref);
5548 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5549 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5552 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5553 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
5554 FREE((void*)this_ptr);
5555 SpendableOutputDescriptor_free(this_ptr_conv);
5558 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5559 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
5560 FREE((void*)this_ptr);
5561 ChannelKeys_free(this_ptr_conv);
5564 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5565 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
5566 FREE((void*)this_ptr);
5567 KeysInterface_free(this_ptr_conv);
5570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5571 LDKInMemoryChannelKeys this_ptr_conv;
5572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5574 InMemoryChannelKeys_free(this_ptr_conv);
5577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5578 LDKInMemoryChannelKeys orig_conv;
5579 orig_conv.inner = (void*)(orig & (~1));
5580 orig_conv.is_owned = (orig & 1) || (orig == 0);
5581 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
5582 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5585 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5586 LDKInMemoryChannelKeys this_ptr_conv;
5587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5589 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5590 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
5594 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5595 LDKInMemoryChannelKeys 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 LDKSecretKey val_ref;
5599 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5600 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5601 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
5604 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5605 LDKInMemoryChannelKeys this_ptr_conv;
5606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5608 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5609 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
5613 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5614 LDKInMemoryChannelKeys this_ptr_conv;
5615 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5616 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5617 LDKSecretKey val_ref;
5618 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5619 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5620 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
5623 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5624 LDKInMemoryChannelKeys this_ptr_conv;
5625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5627 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5628 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
5632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5633 LDKInMemoryChannelKeys this_ptr_conv;
5634 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5635 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5636 LDKSecretKey val_ref;
5637 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5638 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5639 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
5642 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5643 LDKInMemoryChannelKeys this_ptr_conv;
5644 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5645 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5646 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5647 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
5651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5652 LDKInMemoryChannelKeys this_ptr_conv;
5653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5655 LDKSecretKey val_ref;
5656 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5657 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5658 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
5661 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5662 LDKInMemoryChannelKeys this_ptr_conv;
5663 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5664 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5665 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5666 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
5670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKSecretKey val_ref;
5675 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5676 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
5677 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
5680 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5681 LDKInMemoryChannelKeys this_ptr_conv;
5682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5684 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5685 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
5689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
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 LDKThirtyTwoBytes val_ref;
5694 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5695 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5696 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
5699 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) {
5700 LDKSecretKey funding_key_ref;
5701 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
5702 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
5703 LDKSecretKey revocation_base_key_ref;
5704 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
5705 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
5706 LDKSecretKey payment_key_ref;
5707 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
5708 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
5709 LDKSecretKey delayed_payment_base_key_ref;
5710 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
5711 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
5712 LDKSecretKey htlc_base_key_ref;
5713 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
5714 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
5715 LDKThirtyTwoBytes commitment_seed_ref;
5716 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
5717 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
5718 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
5719 FREE((void*)key_derivation_params);
5720 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);
5721 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5724 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5725 LDKInMemoryChannelKeys this_arg_conv;
5726 this_arg_conv.inner = (void*)(this_arg & (~1));
5727 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5728 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
5729 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5732 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5733 LDKInMemoryChannelKeys this_arg_conv;
5734 this_arg_conv.inner = (void*)(this_arg & (~1));
5735 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5736 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
5740 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
5741 LDKInMemoryChannelKeys this_arg_conv;
5742 this_arg_conv.inner = (void*)(this_arg & (~1));
5743 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5744 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
5748 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
5749 LDKInMemoryChannelKeys this_arg_conv;
5750 this_arg_conv.inner = (void*)(this_arg & (~1));
5751 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5752 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
5753 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
5757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5758 LDKInMemoryChannelKeys obj_conv;
5759 obj_conv.inner = (void*)(obj & (~1));
5760 obj_conv.is_owned = (obj & 1) || (obj == 0);
5761 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5762 *ret = InMemoryChannelKeys_write(&obj_conv);
5766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5768 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5769 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5770 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
5771 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5772 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5776 LDKKeysManager this_ptr_conv;
5777 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5778 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5779 KeysManager_free(this_ptr_conv);
5782 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) {
5783 unsigned char seed_arr[32];
5784 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
5785 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
5786 unsigned char (*seed_ref)[32] = &seed_arr;
5787 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5788 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
5789 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5792 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) {
5793 LDKKeysManager this_arg_conv;
5794 this_arg_conv.inner = (void*)(this_arg & (~1));
5795 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5796 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
5797 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
5801 LDKKeysManager this_arg_conv;
5802 this_arg_conv.inner = (void*)(this_arg & (~1));
5803 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5804 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
5805 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
5809 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5810 LDKChannelManager this_ptr_conv;
5811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5813 ChannelManager_free(this_ptr_conv);
5816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5817 LDKChannelDetails this_ptr_conv;
5818 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5819 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5820 ChannelDetails_free(this_ptr_conv);
5823 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5824 LDKChannelDetails orig_conv;
5825 orig_conv.inner = (void*)(orig & (~1));
5826 orig_conv.is_owned = (orig & 1) || (orig == 0);
5827 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
5828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5832 LDKChannelDetails this_ptr_conv;
5833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5835 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
5836 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
5840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5841 LDKChannelDetails this_ptr_conv;
5842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5844 LDKThirtyTwoBytes val_ref;
5845 CHECK((*_env)->GetArrayLength (_env, val) == 32);
5846 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
5847 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
5850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5851 LDKChannelDetails this_ptr_conv;
5852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5854 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
5855 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
5859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
5860 LDKChannelDetails this_ptr_conv;
5861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5863 LDKPublicKey val_ref;
5864 CHECK((*_env)->GetArrayLength (_env, val) == 33);
5865 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
5866 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
5869 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
5870 LDKChannelDetails this_ptr_conv;
5871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5873 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
5874 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5878 LDKChannelDetails this_ptr_conv;
5879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5881 LDKInitFeatures val_conv;
5882 val_conv.inner = (void*)(val & (~1));
5883 val_conv.is_owned = (val & 1) || (val == 0);
5884 // Warning: we may need a move here but can't clone!
5885 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
5888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5889 LDKChannelDetails this_ptr_conv;
5890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5892 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
5896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5897 LDKChannelDetails this_ptr_conv;
5898 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5899 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5900 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
5903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5904 LDKChannelDetails this_ptr_conv;
5905 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5906 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5907 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
5911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5912 LDKChannelDetails this_ptr_conv;
5913 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5914 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5915 ChannelDetails_set_user_id(&this_ptr_conv, val);
5918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5919 LDKChannelDetails this_ptr_conv;
5920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5922 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
5926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong 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 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
5933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5934 LDKChannelDetails this_ptr_conv;
5935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5937 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
5941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5942 LDKChannelDetails this_ptr_conv;
5943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5945 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
5948 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
5949 LDKChannelDetails this_ptr_conv;
5950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5952 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
5956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5957 LDKChannelDetails this_ptr_conv;
5958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5960 ChannelDetails_set_is_live(&this_ptr_conv, val);
5963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5964 LDKPaymentSendFailure 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 PaymentSendFailure_free(this_ptr_conv);
5970 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) {
5971 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
5972 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
5973 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
5974 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5975 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
5977 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
5978 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
5979 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5980 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
5982 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
5983 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5984 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5985 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
5987 LDKLogger logger_conv = *(LDKLogger*)logger;
5988 if (logger_conv.free == LDKLogger_JCalls_free) {
5989 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5990 LDKLogger_JCalls_clone(logger_conv.this_arg);
5992 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
5993 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
5994 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5995 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
5997 LDKUserConfig config_conv;
5998 config_conv.inner = (void*)(config & (~1));
5999 config_conv.is_owned = (config & 1) || (config == 0);
6000 if (config_conv.inner != NULL)
6001 config_conv = UserConfig_clone(&config_conv);
6002 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);
6003 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6006 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) {
6007 LDKChannelManager this_arg_conv;
6008 this_arg_conv.inner = (void*)(this_arg & (~1));
6009 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6010 LDKPublicKey their_network_key_ref;
6011 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6012 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6013 LDKUserConfig override_config_conv;
6014 override_config_conv.inner = (void*)(override_config & (~1));
6015 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6016 if (override_config_conv.inner != NULL)
6017 override_config_conv = UserConfig_clone(&override_config_conv);
6018 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6019 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6024 LDKChannelManager this_arg_conv;
6025 this_arg_conv.inner = (void*)(this_arg & (~1));
6026 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6027 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6028 *ret = ChannelManager_list_channels(&this_arg_conv);
6032 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6033 LDKChannelManager this_arg_conv;
6034 this_arg_conv.inner = (void*)(this_arg & (~1));
6035 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6036 LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
6037 *ret = ChannelManager_list_usable_channels(&this_arg_conv);
6041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6042 LDKChannelManager this_arg_conv;
6043 this_arg_conv.inner = (void*)(this_arg & (~1));
6044 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6045 unsigned char channel_id_arr[32];
6046 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6047 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6048 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6049 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6050 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6054 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6055 LDKChannelManager this_arg_conv;
6056 this_arg_conv.inner = (void*)(this_arg & (~1));
6057 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6058 unsigned char channel_id_arr[32];
6059 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6060 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6061 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6062 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6065 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6066 LDKChannelManager this_arg_conv;
6067 this_arg_conv.inner = (void*)(this_arg & (~1));
6068 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6069 ChannelManager_force_close_all_channels(&this_arg_conv);
6072 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) {
6073 LDKChannelManager this_arg_conv;
6074 this_arg_conv.inner = (void*)(this_arg & (~1));
6075 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6076 LDKRoute route_conv;
6077 route_conv.inner = (void*)(route & (~1));
6078 route_conv.is_owned = (route & 1) || (route == 0);
6079 LDKThirtyTwoBytes payment_hash_ref;
6080 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6081 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6082 LDKThirtyTwoBytes payment_secret_ref;
6083 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6084 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6085 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6086 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6090 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) {
6091 LDKChannelManager this_arg_conv;
6092 this_arg_conv.inner = (void*)(this_arg & (~1));
6093 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6094 unsigned char temporary_channel_id_arr[32];
6095 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6096 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6097 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6098 LDKOutPoint funding_txo_conv;
6099 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6100 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6101 if (funding_txo_conv.inner != NULL)
6102 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6103 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6106 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) {
6107 LDKChannelManager this_arg_conv;
6108 this_arg_conv.inner = (void*)(this_arg & (~1));
6109 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6110 LDKThreeBytes rgb_ref;
6111 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6112 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6113 LDKThirtyTwoBytes alias_ref;
6114 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6115 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6116 LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
6117 FREE((void*)addresses);
6118 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_conv);
6121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6122 LDKChannelManager this_arg_conv;
6123 this_arg_conv.inner = (void*)(this_arg & (~1));
6124 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6125 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6129 LDKChannelManager this_arg_conv;
6130 this_arg_conv.inner = (void*)(this_arg & (~1));
6131 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6132 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6135 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) {
6136 LDKChannelManager this_arg_conv;
6137 this_arg_conv.inner = (void*)(this_arg & (~1));
6138 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6139 unsigned char payment_hash_arr[32];
6140 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6141 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6142 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6143 LDKThirtyTwoBytes payment_secret_ref;
6144 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6145 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6146 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6150 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) {
6151 LDKChannelManager this_arg_conv;
6152 this_arg_conv.inner = (void*)(this_arg & (~1));
6153 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6154 LDKThirtyTwoBytes payment_preimage_ref;
6155 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6156 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6157 LDKThirtyTwoBytes payment_secret_ref;
6158 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6159 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6160 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6164 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6165 LDKChannelManager this_arg_conv;
6166 this_arg_conv.inner = (void*)(this_arg & (~1));
6167 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6168 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6169 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6173 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) {
6174 LDKChannelManager this_arg_conv;
6175 this_arg_conv.inner = (void*)(this_arg & (~1));
6176 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6177 LDKOutPoint funding_txo_conv;
6178 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6179 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6180 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6183 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6184 LDKChannelManager this_arg_conv;
6185 this_arg_conv.inner = (void*)(this_arg & (~1));
6186 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6187 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6188 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
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 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6197 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlong txdata, jint height) {
6202 LDKChannelManager this_arg_conv;
6203 this_arg_conv.inner = (void*)(this_arg & (~1));
6204 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6205 unsigned char header_arr[80];
6206 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6207 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6208 unsigned char (*header_ref)[80] = &header_arr;
6209 LDKCVec_C2Tuple_usizeTransactionZZ txdata_conv = *(LDKCVec_C2Tuple_usizeTransactionZZ*)txdata;
6210 FREE((void*)txdata);
6211 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_conv, height);
6214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
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 unsigned char header_arr[80];
6219 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6220 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6221 unsigned char (*header_ref)[80] = &header_arr;
6222 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
6225 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6226 LDKChannelManager this_arg_conv;
6227 this_arg_conv.inner = (void*)(this_arg & (~1));
6228 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6229 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
6230 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
6234 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6235 LDKChannelManagerReadArgs this_ptr_conv;
6236 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6237 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6238 ChannelManagerReadArgs_free(this_ptr_conv);
6241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
6242 LDKChannelManagerReadArgs this_ptr_conv;
6243 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6244 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6245 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
6249 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6250 LDKChannelManagerReadArgs this_ptr_conv;
6251 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6252 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6253 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
6254 if (val_conv.free == LDKKeysInterface_JCalls_free) {
6255 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6256 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
6258 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
6261 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
6262 LDKChannelManagerReadArgs this_ptr_conv;
6263 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6264 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6265 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
6269 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6270 LDKChannelManagerReadArgs this_ptr_conv;
6271 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6272 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6273 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
6274 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
6275 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6276 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
6278 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
6281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
6282 LDKChannelManagerReadArgs this_ptr_conv;
6283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6285 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
6289 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6290 LDKChannelManagerReadArgs this_ptr_conv;
6291 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6292 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6293 LDKWatch val_conv = *(LDKWatch*)val;
6294 if (val_conv.free == LDKWatch_JCalls_free) {
6295 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6296 LDKWatch_JCalls_clone(val_conv.this_arg);
6298 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
6301 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
6302 LDKChannelManagerReadArgs this_ptr_conv;
6303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6305 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
6309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6310 LDKChannelManagerReadArgs this_ptr_conv;
6311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6313 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
6314 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
6315 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6316 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
6318 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
6321 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
6322 LDKChannelManagerReadArgs this_ptr_conv;
6323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6325 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
6329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6330 LDKChannelManagerReadArgs this_ptr_conv;
6331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6333 LDKLogger val_conv = *(LDKLogger*)val;
6334 if (val_conv.free == LDKLogger_JCalls_free) {
6335 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6336 LDKLogger_JCalls_clone(val_conv.this_arg);
6338 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
6341 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
6342 LDKChannelManagerReadArgs this_ptr_conv;
6343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6345 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
6346 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6349 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6350 LDKChannelManagerReadArgs this_ptr_conv;
6351 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6352 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6353 LDKUserConfig val_conv;
6354 val_conv.inner = (void*)(val & (~1));
6355 val_conv.is_owned = (val & 1) || (val == 0);
6356 if (val_conv.inner != NULL)
6357 val_conv = UserConfig_clone(&val_conv);
6358 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
6361 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) {
6362 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6363 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6364 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6365 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6367 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6368 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6369 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6370 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6372 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6373 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6374 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6375 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6377 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6378 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6379 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6380 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6382 LDKLogger logger_conv = *(LDKLogger*)logger;
6383 if (logger_conv.free == LDKLogger_JCalls_free) {
6384 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6385 LDKLogger_JCalls_clone(logger_conv.this_arg);
6387 LDKUserConfig default_config_conv;
6388 default_config_conv.inner = (void*)(default_config & (~1));
6389 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
6390 if (default_config_conv.inner != NULL)
6391 default_config_conv = UserConfig_clone(&default_config_conv);
6392 LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
6393 FREE((void*)channel_monitors);
6394 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
6395 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6399 LDKDecodeError this_ptr_conv;
6400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6402 DecodeError_free(this_ptr_conv);
6405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6406 LDKInit this_ptr_conv;
6407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6409 Init_free(this_ptr_conv);
6412 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6414 orig_conv.inner = (void*)(orig & (~1));
6415 orig_conv.is_owned = (orig & 1) || (orig == 0);
6416 LDKInit ret = Init_clone(&orig_conv);
6417 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6420 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6421 LDKErrorMessage this_ptr_conv;
6422 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6423 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6424 ErrorMessage_free(this_ptr_conv);
6427 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6428 LDKErrorMessage orig_conv;
6429 orig_conv.inner = (void*)(orig & (~1));
6430 orig_conv.is_owned = (orig & 1) || (orig == 0);
6431 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
6432 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6435 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6436 LDKErrorMessage 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6440 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
6444 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6445 LDKErrorMessage this_ptr_conv;
6446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6448 LDKThirtyTwoBytes val_ref;
6449 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6450 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6451 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
6454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
6455 LDKErrorMessage this_ptr_conv;
6456 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6457 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6458 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
6459 *ret = ErrorMessage_get_data(&this_ptr_conv);
6463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6464 LDKErrorMessage this_ptr_conv;
6465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6467 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6469 ErrorMessage_set_data(&this_ptr_conv, val_conv);
6472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong data_arg) {
6473 LDKThirtyTwoBytes channel_id_arg_ref;
6474 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
6475 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
6476 LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
6477 FREE((void*)data_arg);
6478 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_conv);
6479 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6482 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6483 LDKPing this_ptr_conv;
6484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6486 Ping_free(this_ptr_conv);
6489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6491 orig_conv.inner = (void*)(orig & (~1));
6492 orig_conv.is_owned = (orig & 1) || (orig == 0);
6493 LDKPing ret = Ping_clone(&orig_conv);
6494 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6497 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6498 LDKPing this_ptr_conv;
6499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6501 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
6505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6506 LDKPing this_ptr_conv;
6507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6509 Ping_set_ponglen(&this_ptr_conv, val);
6512 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6513 LDKPing this_ptr_conv;
6514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6516 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
6520 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6521 LDKPing this_ptr_conv;
6522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6524 Ping_set_byteslen(&this_ptr_conv, val);
6527 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
6528 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
6529 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6533 LDKPong this_ptr_conv;
6534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6536 Pong_free(this_ptr_conv);
6539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6541 orig_conv.inner = (void*)(orig & (~1));
6542 orig_conv.is_owned = (orig & 1) || (orig == 0);
6543 LDKPong ret = Pong_clone(&orig_conv);
6544 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6547 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
6548 LDKPong this_ptr_conv;
6549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6551 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
6555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6556 LDKPong this_ptr_conv;
6557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6559 Pong_set_byteslen(&this_ptr_conv, val);
6562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
6563 LDKPong ret = Pong_new(byteslen_arg);
6564 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6568 LDKOpenChannel this_ptr_conv;
6569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6571 OpenChannel_free(this_ptr_conv);
6574 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6575 LDKOpenChannel orig_conv;
6576 orig_conv.inner = (void*)(orig & (~1));
6577 orig_conv.is_owned = (orig & 1) || (orig == 0);
6578 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
6579 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6582 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6583 LDKOpenChannel this_ptr_conv;
6584 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6585 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6586 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6587 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
6591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6592 LDKOpenChannel this_ptr_conv;
6593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6595 LDKThirtyTwoBytes val_ref;
6596 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6597 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6598 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
6601 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6602 LDKOpenChannel this_ptr_conv;
6603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6605 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6606 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
6610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6611 LDKOpenChannel 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 LDKThirtyTwoBytes val_ref;
6615 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6616 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6617 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6621 LDKOpenChannel this_ptr_conv;
6622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6624 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
6628 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6629 LDKOpenChannel this_ptr_conv;
6630 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6631 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6632 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
6635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6636 LDKOpenChannel this_ptr_conv;
6637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6639 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
6643 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6644 LDKOpenChannel this_ptr_conv;
6645 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6646 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6647 OpenChannel_set_push_msat(&this_ptr_conv, val);
6650 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6651 LDKOpenChannel this_ptr_conv;
6652 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6653 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6654 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
6658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6659 LDKOpenChannel this_ptr_conv;
6660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6662 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6666 LDKOpenChannel this_ptr_conv;
6667 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6668 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6669 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6673 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) {
6674 LDKOpenChannel this_ptr_conv;
6675 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6676 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6677 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6680 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6681 LDKOpenChannel this_ptr_conv;
6682 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6683 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6684 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6688 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6689 LDKOpenChannel this_ptr_conv;
6690 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6691 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6692 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6696 LDKOpenChannel this_ptr_conv;
6697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6699 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
6703 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6704 LDKOpenChannel this_ptr_conv;
6705 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6706 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6707 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6710 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(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 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
6718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint 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_feerate_per_kw(&this_ptr_conv, val);
6725 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(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 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
6733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort 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_to_self_delay(&this_ptr_conv, val);
6740 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(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 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
6748 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort 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_max_accepted_htlcs(&this_ptr_conv, val);
6755 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6760 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
6764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6765 LDKOpenChannel this_ptr_conv;
6766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6768 LDKPublicKey val_ref;
6769 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6770 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6771 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
6774 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6775 LDKOpenChannel this_ptr_conv;
6776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6778 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6779 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
6783 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6784 LDKOpenChannel this_ptr_conv;
6785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6787 LDKPublicKey val_ref;
6788 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6789 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6790 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
6793 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6798 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
6802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6803 LDKOpenChannel this_ptr_conv;
6804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6806 LDKPublicKey val_ref;
6807 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6808 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6809 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
6812 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6813 LDKOpenChannel this_ptr_conv;
6814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6816 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6817 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
6821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6822 LDKOpenChannel this_ptr_conv;
6823 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6824 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6825 LDKPublicKey val_ref;
6826 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6827 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6828 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
6831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
6832 LDKOpenChannel this_ptr_conv;
6833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6835 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6836 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
6840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6841 LDKOpenChannel this_ptr_conv;
6842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6844 LDKPublicKey val_ref;
6845 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6846 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6847 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
6850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
6851 LDKOpenChannel this_ptr_conv;
6852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6854 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6855 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
6859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6860 LDKOpenChannel this_ptr_conv;
6861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6863 LDKPublicKey val_ref;
6864 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6865 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6866 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
6869 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
6870 LDKOpenChannel this_ptr_conv;
6871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6873 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
6877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
6878 LDKOpenChannel this_ptr_conv;
6879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6881 OpenChannel_set_channel_flags(&this_ptr_conv, val);
6884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6885 LDKAcceptChannel this_ptr_conv;
6886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6888 AcceptChannel_free(this_ptr_conv);
6891 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6892 LDKAcceptChannel orig_conv;
6893 orig_conv.inner = (void*)(orig & (~1));
6894 orig_conv.is_owned = (orig & 1) || (orig == 0);
6895 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
6896 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6899 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6900 LDKAcceptChannel this_ptr_conv;
6901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6903 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6904 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
6908 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6909 LDKAcceptChannel this_ptr_conv;
6910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6912 LDKThirtyTwoBytes val_ref;
6913 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6914 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6915 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
6918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6919 LDKAcceptChannel this_ptr_conv;
6920 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6921 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6922 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
6926 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6927 LDKAcceptChannel this_ptr_conv;
6928 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6929 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6930 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
6933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6934 LDKAcceptChannel this_ptr_conv;
6935 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6936 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6937 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
6941 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) {
6942 LDKAcceptChannel this_ptr_conv;
6943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6945 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
6948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6949 LDKAcceptChannel this_ptr_conv;
6950 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6951 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6952 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
6956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6957 LDKAcceptChannel this_ptr_conv;
6958 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6959 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6960 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
6963 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6964 LDKAcceptChannel this_ptr_conv;
6965 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6966 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6967 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
6971 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6972 LDKAcceptChannel this_ptr_conv;
6973 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6974 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6975 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
6978 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
6979 LDKAcceptChannel this_ptr_conv;
6980 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6981 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6982 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
6986 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6987 LDKAcceptChannel this_ptr_conv;
6988 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6989 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6990 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
6993 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
6994 LDKAcceptChannel this_ptr_conv;
6995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6997 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7002 LDKAcceptChannel this_ptr_conv;
7003 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7004 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7005 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7008 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(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 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort 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_max_accepted_htlcs(&this_ptr_conv, val);
7023 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7028 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7032 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7033 LDKAcceptChannel this_ptr_conv;
7034 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7035 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7036 LDKPublicKey val_ref;
7037 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7038 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7039 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7042 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7043 LDKAcceptChannel this_ptr_conv;
7044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7046 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7047 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7052 LDKAcceptChannel this_ptr_conv;
7053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7055 LDKPublicKey val_ref;
7056 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7057 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7058 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7061 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7066 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7071 LDKAcceptChannel this_ptr_conv;
7072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7074 LDKPublicKey val_ref;
7075 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7076 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7077 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7080 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7081 LDKAcceptChannel this_ptr_conv;
7082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7084 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7085 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7089 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7090 LDKAcceptChannel this_ptr_conv;
7091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7093 LDKPublicKey val_ref;
7094 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7095 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7096 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7099 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7100 LDKAcceptChannel this_ptr_conv;
7101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7103 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7104 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7108 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7109 LDKAcceptChannel this_ptr_conv;
7110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7112 LDKPublicKey val_ref;
7113 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7114 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7115 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7118 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7119 LDKAcceptChannel this_ptr_conv;
7120 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7121 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7122 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7123 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7127 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7128 LDKAcceptChannel this_ptr_conv;
7129 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7130 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7131 LDKPublicKey val_ref;
7132 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7133 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7134 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7138 LDKFundingCreated this_ptr_conv;
7139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7141 FundingCreated_free(this_ptr_conv);
7144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7145 LDKFundingCreated orig_conv;
7146 orig_conv.inner = (void*)(orig & (~1));
7147 orig_conv.is_owned = (orig & 1) || (orig == 0);
7148 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7149 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7152 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7153 LDKFundingCreated this_ptr_conv;
7154 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7155 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7156 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7157 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7162 LDKFundingCreated this_ptr_conv;
7163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7165 LDKThirtyTwoBytes val_ref;
7166 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7167 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7168 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7171 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7172 LDKFundingCreated this_ptr_conv;
7173 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7174 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7175 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7176 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7181 LDKFundingCreated this_ptr_conv;
7182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7184 LDKThirtyTwoBytes val_ref;
7185 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7186 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7187 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7190 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
7191 LDKFundingCreated this_ptr_conv;
7192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7194 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
7198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7199 LDKFundingCreated 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 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
7205 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7206 LDKFundingCreated this_ptr_conv;
7207 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7208 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7209 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7210 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
7214 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7215 LDKFundingCreated this_ptr_conv;
7216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7218 LDKSignature val_ref;
7219 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7220 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7221 FundingCreated_set_signature(&this_ptr_conv, val_ref);
7224 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) {
7225 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
7226 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
7227 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
7228 LDKThirtyTwoBytes funding_txid_arg_ref;
7229 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
7230 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
7231 LDKSignature signature_arg_ref;
7232 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7233 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7234 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
7235 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7239 LDKFundingSigned this_ptr_conv;
7240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7242 FundingSigned_free(this_ptr_conv);
7245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7246 LDKFundingSigned orig_conv;
7247 orig_conv.inner = (void*)(orig & (~1));
7248 orig_conv.is_owned = (orig & 1) || (orig == 0);
7249 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
7250 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7253 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7254 LDKFundingSigned this_ptr_conv;
7255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7257 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7258 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
7262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7263 LDKFundingSigned this_ptr_conv;
7264 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7265 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7266 LDKThirtyTwoBytes val_ref;
7267 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7268 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7269 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
7272 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7273 LDKFundingSigned this_ptr_conv;
7274 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7275 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7276 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7277 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
7281 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7282 LDKFundingSigned this_ptr_conv;
7283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7285 LDKSignature val_ref;
7286 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7287 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7288 FundingSigned_set_signature(&this_ptr_conv, val_ref);
7291 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
7292 LDKThirtyTwoBytes channel_id_arg_ref;
7293 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7294 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7295 LDKSignature signature_arg_ref;
7296 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7297 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7298 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
7299 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7303 LDKFundingLocked this_ptr_conv;
7304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7306 FundingLocked_free(this_ptr_conv);
7309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7310 LDKFundingLocked orig_conv;
7311 orig_conv.inner = (void*)(orig & (~1));
7312 orig_conv.is_owned = (orig & 1) || (orig == 0);
7313 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
7314 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7317 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7318 LDKFundingLocked this_ptr_conv;
7319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7321 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7322 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
7326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7327 LDKFundingLocked this_ptr_conv;
7328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7330 LDKThirtyTwoBytes val_ref;
7331 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7332 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7333 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
7336 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7337 LDKFundingLocked this_ptr_conv;
7338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7340 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7341 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7346 LDKFundingLocked this_ptr_conv;
7347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7349 LDKPublicKey val_ref;
7350 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7351 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7352 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7355 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
7356 LDKThirtyTwoBytes channel_id_arg_ref;
7357 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7358 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7359 LDKPublicKey next_per_commitment_point_arg_ref;
7360 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7361 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7362 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
7363 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7367 LDKShutdown this_ptr_conv;
7368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7370 Shutdown_free(this_ptr_conv);
7373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7374 LDKShutdown orig_conv;
7375 orig_conv.inner = (void*)(orig & (~1));
7376 orig_conv.is_owned = (orig & 1) || (orig == 0);
7377 LDKShutdown ret = Shutdown_clone(&orig_conv);
7378 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7381 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7382 LDKShutdown this_ptr_conv;
7383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7385 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7386 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
7390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7391 LDKShutdown this_ptr_conv;
7392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7394 LDKThirtyTwoBytes val_ref;
7395 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7396 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7397 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
7400 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7401 LDKShutdown this_ptr_conv;
7402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7404 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
7405 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
7406 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
7410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7411 LDKShutdown this_ptr_conv;
7412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7414 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
7416 Shutdown_set_scriptpubkey(&this_ptr_conv, val_conv);
7419 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jlong scriptpubkey_arg) {
7420 LDKThirtyTwoBytes channel_id_arg_ref;
7421 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7422 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7423 LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
7424 FREE((void*)scriptpubkey_arg);
7425 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_conv);
7426 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7430 LDKClosingSigned this_ptr_conv;
7431 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7432 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7433 ClosingSigned_free(this_ptr_conv);
7436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7437 LDKClosingSigned orig_conv;
7438 orig_conv.inner = (void*)(orig & (~1));
7439 orig_conv.is_owned = (orig & 1) || (orig == 0);
7440 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
7441 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7444 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7445 LDKClosingSigned this_ptr_conv;
7446 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7447 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7448 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7449 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
7453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7454 LDKClosingSigned this_ptr_conv;
7455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7457 LDKThirtyTwoBytes val_ref;
7458 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7459 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7460 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
7463 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7464 LDKClosingSigned this_ptr_conv;
7465 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7466 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7467 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
7471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7472 LDKClosingSigned 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 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
7478 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7479 LDKClosingSigned this_ptr_conv;
7480 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7481 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7482 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7483 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
7487 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7488 LDKClosingSigned this_ptr_conv;
7489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7491 LDKSignature val_ref;
7492 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7493 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7494 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
7497 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) {
7498 LDKThirtyTwoBytes channel_id_arg_ref;
7499 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7500 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7501 LDKSignature signature_arg_ref;
7502 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7503 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7504 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
7505 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7509 LDKUpdateAddHTLC this_ptr_conv;
7510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7512 UpdateAddHTLC_free(this_ptr_conv);
7515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7516 LDKUpdateAddHTLC orig_conv;
7517 orig_conv.inner = (void*)(orig & (~1));
7518 orig_conv.is_owned = (orig & 1) || (orig == 0);
7519 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
7520 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7523 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7524 LDKUpdateAddHTLC 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7528 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
7532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7533 LDKUpdateAddHTLC this_ptr_conv;
7534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7536 LDKThirtyTwoBytes val_ref;
7537 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7538 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7539 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
7542 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7543 LDKUpdateAddHTLC this_ptr_conv;
7544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7546 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
7550 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7551 LDKUpdateAddHTLC this_ptr_conv;
7552 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7553 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7554 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
7557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7558 LDKUpdateAddHTLC 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 = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
7565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7566 LDKUpdateAddHTLC 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 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
7572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7573 LDKUpdateAddHTLC 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 ret_arr = (*_env)->NewByteArray(_env, 32);
7577 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
7581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7582 LDKUpdateAddHTLC 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 LDKThirtyTwoBytes val_ref;
7586 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7587 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7588 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
7591 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
7592 LDKUpdateAddHTLC this_ptr_conv;
7593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7595 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
7599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7600 LDKUpdateAddHTLC this_ptr_conv;
7601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7603 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
7606 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7607 LDKUpdateFulfillHTLC this_ptr_conv;
7608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7610 UpdateFulfillHTLC_free(this_ptr_conv);
7613 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7614 LDKUpdateFulfillHTLC orig_conv;
7615 orig_conv.inner = (void*)(orig & (~1));
7616 orig_conv.is_owned = (orig & 1) || (orig == 0);
7617 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
7618 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7621 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7622 LDKUpdateFulfillHTLC this_ptr_conv;
7623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7625 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7626 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
7630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7631 LDKUpdateFulfillHTLC this_ptr_conv;
7632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7634 LDKThirtyTwoBytes val_ref;
7635 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7636 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7637 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
7640 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7641 LDKUpdateFulfillHTLC this_ptr_conv;
7642 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7643 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7644 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
7648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7649 LDKUpdateFulfillHTLC this_ptr_conv;
7650 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7651 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7652 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
7655 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
7656 LDKUpdateFulfillHTLC this_ptr_conv;
7657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7659 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7660 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
7664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7665 LDKUpdateFulfillHTLC this_ptr_conv;
7666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7668 LDKThirtyTwoBytes val_ref;
7669 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7670 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7671 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
7674 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) {
7675 LDKThirtyTwoBytes channel_id_arg_ref;
7676 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7677 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7678 LDKThirtyTwoBytes payment_preimage_arg_ref;
7679 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
7680 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
7681 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
7682 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7686 LDKUpdateFailHTLC 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 UpdateFailHTLC_free(this_ptr_conv);
7692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7693 LDKUpdateFailHTLC orig_conv;
7694 orig_conv.inner = (void*)(orig & (~1));
7695 orig_conv.is_owned = (orig & 1) || (orig == 0);
7696 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
7697 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7700 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7701 LDKUpdateFailHTLC 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7705 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
7709 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7710 LDKUpdateFailHTLC this_ptr_conv;
7711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7713 LDKThirtyTwoBytes val_ref;
7714 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7715 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7716 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
7719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7720 LDKUpdateFailHTLC this_ptr_conv;
7721 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7722 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7723 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
7727 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7728 LDKUpdateFailHTLC this_ptr_conv;
7729 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7730 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7731 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
7734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7735 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_free(this_ptr_conv);
7741 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7742 LDKUpdateFailMalformedHTLC orig_conv;
7743 orig_conv.inner = (void*)(orig & (~1));
7744 orig_conv.is_owned = (orig & 1) || (orig == 0);
7745 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
7746 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7749 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7750 LDKUpdateFailMalformedHTLC 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, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
7758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7759 LDKUpdateFailMalformedHTLC 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 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
7768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7769 LDKUpdateFailMalformedHTLC this_ptr_conv;
7770 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7771 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7772 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
7776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7777 LDKUpdateFailMalformedHTLC this_ptr_conv;
7778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7780 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
7783 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
7784 LDKUpdateFailMalformedHTLC this_ptr_conv;
7785 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7786 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7787 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
7791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7792 LDKUpdateFailMalformedHTLC this_ptr_conv;
7793 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7794 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7795 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
7798 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7799 LDKCommitmentSigned this_ptr_conv;
7800 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7801 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7802 CommitmentSigned_free(this_ptr_conv);
7805 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7806 LDKCommitmentSigned orig_conv;
7807 orig_conv.inner = (void*)(orig & (~1));
7808 orig_conv.is_owned = (orig & 1) || (orig == 0);
7809 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
7810 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7813 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7814 LDKCommitmentSigned 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7818 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
7822 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7823 LDKCommitmentSigned this_ptr_conv;
7824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7826 LDKThirtyTwoBytes val_ref;
7827 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7828 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7829 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
7832 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
7833 LDKCommitmentSigned this_ptr_conv;
7834 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7835 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7836 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
7837 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
7841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7842 LDKCommitmentSigned this_ptr_conv;
7843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7845 LDKSignature val_ref;
7846 CHECK((*_env)->GetArrayLength (_env, val) == 64);
7847 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
7848 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
7851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7852 LDKCommitmentSigned this_ptr_conv;
7853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7855 LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
7857 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_conv);
7860 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) {
7861 LDKThirtyTwoBytes channel_id_arg_ref;
7862 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7863 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7864 LDKSignature signature_arg_ref;
7865 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
7866 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
7867 LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
7868 FREE((void*)htlc_signatures_arg);
7869 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_conv);
7870 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7874 LDKRevokeAndACK this_ptr_conv;
7875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7877 RevokeAndACK_free(this_ptr_conv);
7880 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7881 LDKRevokeAndACK orig_conv;
7882 orig_conv.inner = (void*)(orig & (~1));
7883 orig_conv.is_owned = (orig & 1) || (orig == 0);
7884 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
7885 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7888 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7889 LDKRevokeAndACK this_ptr_conv;
7890 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7891 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7892 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7893 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
7897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7898 LDKRevokeAndACK this_ptr_conv;
7899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7901 LDKThirtyTwoBytes val_ref;
7902 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7903 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7904 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
7907 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
7908 LDKRevokeAndACK 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, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
7916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7917 LDKRevokeAndACK 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 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
7926 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7927 LDKRevokeAndACK 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, 33);
7931 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
7935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7936 LDKRevokeAndACK 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 LDKPublicKey val_ref;
7940 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7941 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7942 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
7945 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) {
7946 LDKThirtyTwoBytes channel_id_arg_ref;
7947 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7948 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7949 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
7950 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
7951 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
7952 LDKPublicKey next_per_commitment_point_arg_ref;
7953 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
7954 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
7955 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
7956 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7959 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7960 LDKUpdateFee this_ptr_conv;
7961 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7962 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7963 UpdateFee_free(this_ptr_conv);
7966 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7967 LDKUpdateFee orig_conv;
7968 orig_conv.inner = (void*)(orig & (~1));
7969 orig_conv.is_owned = (orig & 1) || (orig == 0);
7970 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
7971 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7974 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7975 LDKUpdateFee this_ptr_conv;
7976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7978 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7979 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
7983 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7984 LDKUpdateFee this_ptr_conv;
7985 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7986 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7987 LDKThirtyTwoBytes val_ref;
7988 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7989 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7990 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
7993 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7994 LDKUpdateFee this_ptr_conv;
7995 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7996 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7997 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8002 LDKUpdateFee 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 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8009 LDKThirtyTwoBytes channel_id_arg_ref;
8010 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8011 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8012 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8013 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8017 LDKDataLossProtect this_ptr_conv;
8018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8020 DataLossProtect_free(this_ptr_conv);
8023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8024 LDKDataLossProtect orig_conv;
8025 orig_conv.inner = (void*)(orig & (~1));
8026 orig_conv.is_owned = (orig & 1) || (orig == 0);
8027 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8028 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8031 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8032 LDKDataLossProtect this_ptr_conv;
8033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8035 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8036 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8040 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8041 LDKDataLossProtect this_ptr_conv;
8042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8044 LDKThirtyTwoBytes val_ref;
8045 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8046 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8047 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8050 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8051 LDKDataLossProtect this_ptr_conv;
8052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8054 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8055 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8060 LDKDataLossProtect this_ptr_conv;
8061 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8062 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8063 LDKPublicKey val_ref;
8064 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8065 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8066 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8069 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) {
8070 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8071 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8072 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8073 LDKPublicKey my_current_per_commitment_point_arg_ref;
8074 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8075 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8076 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8077 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8081 LDKChannelReestablish this_ptr_conv;
8082 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8083 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8084 ChannelReestablish_free(this_ptr_conv);
8087 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8088 LDKChannelReestablish orig_conv;
8089 orig_conv.inner = (void*)(orig & (~1));
8090 orig_conv.is_owned = (orig & 1) || (orig == 0);
8091 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8092 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8095 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8096 LDKChannelReestablish 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8100 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8104 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8105 LDKChannelReestablish this_ptr_conv;
8106 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8107 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8108 LDKThirtyTwoBytes val_ref;
8109 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8110 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8111 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8114 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8115 LDKChannelReestablish this_ptr_conv;
8116 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8117 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8118 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8123 LDKChannelReestablish this_ptr_conv;
8124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8126 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8130 LDKChannelReestablish this_ptr_conv;
8131 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8132 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8133 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8138 LDKChannelReestablish this_ptr_conv;
8139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8141 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8145 LDKAnnouncementSignatures 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 AnnouncementSignatures_free(this_ptr_conv);
8151 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8152 LDKAnnouncementSignatures orig_conv;
8153 orig_conv.inner = (void*)(orig & (~1));
8154 orig_conv.is_owned = (orig & 1) || (orig == 0);
8155 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8156 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8159 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8160 LDKAnnouncementSignatures this_ptr_conv;
8161 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8162 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8163 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8164 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
8168 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8169 LDKAnnouncementSignatures this_ptr_conv;
8170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8171 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8172 LDKThirtyTwoBytes val_ref;
8173 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8174 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8175 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
8178 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8179 LDKAnnouncementSignatures this_ptr_conv;
8180 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8181 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8182 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
8186 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8187 LDKAnnouncementSignatures this_ptr_conv;
8188 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8189 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8190 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
8193 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8194 LDKAnnouncementSignatures this_ptr_conv;
8195 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8196 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8197 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8198 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
8202 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8203 LDKAnnouncementSignatures this_ptr_conv;
8204 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8205 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8206 LDKSignature val_ref;
8207 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8208 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8209 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
8212 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8213 LDKAnnouncementSignatures this_ptr_conv;
8214 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8215 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8216 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8217 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
8221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8222 LDKAnnouncementSignatures this_ptr_conv;
8223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8225 LDKSignature val_ref;
8226 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8227 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8228 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
8231 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) {
8232 LDKThirtyTwoBytes channel_id_arg_ref;
8233 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8234 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8235 LDKSignature node_signature_arg_ref;
8236 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
8237 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
8238 LDKSignature bitcoin_signature_arg_ref;
8239 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
8240 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
8241 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
8242 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8246 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
8247 FREE((void*)this_ptr);
8248 NetAddress_free(this_ptr_conv);
8251 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8252 LDKUnsignedNodeAnnouncement this_ptr_conv;
8253 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8254 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8255 UnsignedNodeAnnouncement_free(this_ptr_conv);
8258 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8259 LDKUnsignedNodeAnnouncement orig_conv;
8260 orig_conv.inner = (void*)(orig & (~1));
8261 orig_conv.is_owned = (orig & 1) || (orig == 0);
8262 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
8263 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8266 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8267 LDKUnsignedNodeAnnouncement this_ptr_conv;
8268 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8269 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8270 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
8271 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8275 LDKUnsignedNodeAnnouncement this_ptr_conv;
8276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8278 LDKNodeFeatures val_conv;
8279 val_conv.inner = (void*)(val & (~1));
8280 val_conv.is_owned = (val & 1) || (val == 0);
8281 // Warning: we may need a move here but can't clone!
8282 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
8285 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8286 LDKUnsignedNodeAnnouncement this_ptr_conv;
8287 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8288 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8289 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
8293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8294 LDKUnsignedNodeAnnouncement this_ptr_conv;
8295 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8296 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8297 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
8300 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8301 LDKUnsignedNodeAnnouncement this_ptr_conv;
8302 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8303 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8304 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8305 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
8309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8310 LDKUnsignedNodeAnnouncement this_ptr_conv;
8311 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8312 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8313 LDKPublicKey val_ref;
8314 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8315 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8316 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
8319 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
8320 LDKUnsignedNodeAnnouncement this_ptr_conv;
8321 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8322 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8323 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
8324 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
8328 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8329 LDKUnsignedNodeAnnouncement this_ptr_conv;
8330 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8331 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8332 LDKThreeBytes val_ref;
8333 CHECK((*_env)->GetArrayLength (_env, val) == 3);
8334 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
8335 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
8338 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
8339 LDKUnsignedNodeAnnouncement this_ptr_conv;
8340 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8341 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8342 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8343 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
8347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8348 LDKUnsignedNodeAnnouncement this_ptr_conv;
8349 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8350 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8351 LDKThirtyTwoBytes val_ref;
8352 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8353 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8354 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
8357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8358 LDKUnsignedNodeAnnouncement this_ptr_conv;
8359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8361 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
8363 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_conv);
8366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8367 LDKNodeAnnouncement this_ptr_conv;
8368 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8369 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8370 NodeAnnouncement_free(this_ptr_conv);
8373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8374 LDKNodeAnnouncement orig_conv;
8375 orig_conv.inner = (void*)(orig & (~1));
8376 orig_conv.is_owned = (orig & 1) || (orig == 0);
8377 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
8378 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8381 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8382 LDKNodeAnnouncement this_ptr_conv;
8383 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8384 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8385 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8386 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
8390 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8391 LDKNodeAnnouncement this_ptr_conv;
8392 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8393 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8394 LDKSignature val_ref;
8395 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8396 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8397 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
8400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8401 LDKNodeAnnouncement this_ptr_conv;
8402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8404 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
8405 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8409 LDKNodeAnnouncement this_ptr_conv;
8410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8412 LDKUnsignedNodeAnnouncement val_conv;
8413 val_conv.inner = (void*)(val & (~1));
8414 val_conv.is_owned = (val & 1) || (val == 0);
8415 if (val_conv.inner != NULL)
8416 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
8417 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
8420 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8421 LDKSignature signature_arg_ref;
8422 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8423 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8424 LDKUnsignedNodeAnnouncement contents_arg_conv;
8425 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8426 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8427 if (contents_arg_conv.inner != NULL)
8428 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
8429 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
8430 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8433 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8434 LDKUnsignedChannelAnnouncement this_ptr_conv;
8435 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8436 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8437 UnsignedChannelAnnouncement_free(this_ptr_conv);
8440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8441 LDKUnsignedChannelAnnouncement orig_conv;
8442 orig_conv.inner = (void*)(orig & (~1));
8443 orig_conv.is_owned = (orig & 1) || (orig == 0);
8444 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
8445 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8448 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
8449 LDKUnsignedChannelAnnouncement this_ptr_conv;
8450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8452 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
8453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8456 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8457 LDKUnsignedChannelAnnouncement this_ptr_conv;
8458 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8459 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8460 LDKChannelFeatures val_conv;
8461 val_conv.inner = (void*)(val & (~1));
8462 val_conv.is_owned = (val & 1) || (val == 0);
8463 // Warning: we may need a move here but can't clone!
8464 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
8467 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8468 LDKUnsignedChannelAnnouncement this_ptr_conv;
8469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8471 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8472 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
8476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8477 LDKUnsignedChannelAnnouncement this_ptr_conv;
8478 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8479 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8480 LDKThirtyTwoBytes val_ref;
8481 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8482 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8483 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
8486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8487 LDKUnsignedChannelAnnouncement this_ptr_conv;
8488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8490 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
8494 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8495 LDKUnsignedChannelAnnouncement 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 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
8501 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8502 LDKUnsignedChannelAnnouncement this_ptr_conv;
8503 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8504 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8505 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8506 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
8510 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8511 LDKUnsignedChannelAnnouncement this_ptr_conv;
8512 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8513 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8514 LDKPublicKey val_ref;
8515 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8516 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8517 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
8520 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8521 LDKUnsignedChannelAnnouncement this_ptr_conv;
8522 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8523 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8524 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8525 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
8529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8530 LDKUnsignedChannelAnnouncement this_ptr_conv;
8531 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8532 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8533 LDKPublicKey val_ref;
8534 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8535 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8536 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
8539 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8540 LDKUnsignedChannelAnnouncement this_ptr_conv;
8541 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8542 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8543 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8544 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
8548 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8549 LDKUnsignedChannelAnnouncement this_ptr_conv;
8550 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8551 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8552 LDKPublicKey val_ref;
8553 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8554 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8555 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
8558 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8559 LDKUnsignedChannelAnnouncement this_ptr_conv;
8560 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8561 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8562 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8563 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
8567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8568 LDKUnsignedChannelAnnouncement this_ptr_conv;
8569 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8570 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8571 LDKPublicKey val_ref;
8572 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8573 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8574 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
8577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8578 LDKChannelAnnouncement this_ptr_conv;
8579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8581 ChannelAnnouncement_free(this_ptr_conv);
8584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8585 LDKChannelAnnouncement orig_conv;
8586 orig_conv.inner = (void*)(orig & (~1));
8587 orig_conv.is_owned = (orig & 1) || (orig == 0);
8588 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
8589 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8592 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8593 LDKChannelAnnouncement this_ptr_conv;
8594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8596 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8597 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
8601 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8602 LDKChannelAnnouncement this_ptr_conv;
8603 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8604 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8605 LDKSignature val_ref;
8606 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8607 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8608 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
8611 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8612 LDKChannelAnnouncement this_ptr_conv;
8613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8615 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8616 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
8620 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8621 LDKChannelAnnouncement this_ptr_conv;
8622 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8623 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8624 LDKSignature val_ref;
8625 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8626 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8627 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
8630 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
8631 LDKChannelAnnouncement this_ptr_conv;
8632 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8633 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8634 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8635 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
8639 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8640 LDKChannelAnnouncement this_ptr_conv;
8641 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8642 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8643 LDKSignature val_ref;
8644 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8645 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8646 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
8649 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
8650 LDKChannelAnnouncement this_ptr_conv;
8651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8652 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8653 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8654 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
8658 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8659 LDKChannelAnnouncement this_ptr_conv;
8660 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8661 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8662 LDKSignature val_ref;
8663 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8664 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8665 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
8668 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8669 LDKChannelAnnouncement this_ptr_conv;
8670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8672 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
8673 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8677 LDKChannelAnnouncement this_ptr_conv;
8678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8680 LDKUnsignedChannelAnnouncement val_conv;
8681 val_conv.inner = (void*)(val & (~1));
8682 val_conv.is_owned = (val & 1) || (val == 0);
8683 if (val_conv.inner != NULL)
8684 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
8685 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
8688 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) {
8689 LDKSignature node_signature_1_arg_ref;
8690 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
8691 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
8692 LDKSignature node_signature_2_arg_ref;
8693 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
8694 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
8695 LDKSignature bitcoin_signature_1_arg_ref;
8696 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
8697 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
8698 LDKSignature bitcoin_signature_2_arg_ref;
8699 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
8700 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
8701 LDKUnsignedChannelAnnouncement contents_arg_conv;
8702 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8703 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8704 if (contents_arg_conv.inner != NULL)
8705 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
8706 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);
8707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8711 LDKUnsignedChannelUpdate this_ptr_conv;
8712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8714 UnsignedChannelUpdate_free(this_ptr_conv);
8717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8718 LDKUnsignedChannelUpdate orig_conv;
8719 orig_conv.inner = (void*)(orig & (~1));
8720 orig_conv.is_owned = (orig & 1) || (orig == 0);
8721 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
8722 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8725 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8726 LDKUnsignedChannelUpdate this_ptr_conv;
8727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8729 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8730 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
8734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8735 LDKUnsignedChannelUpdate this_ptr_conv;
8736 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8737 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8738 LDKThirtyTwoBytes val_ref;
8739 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8740 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8741 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
8744 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8745 LDKUnsignedChannelUpdate this_ptr_conv;
8746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8748 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
8752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8753 LDKUnsignedChannelUpdate 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 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
8759 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
8760 LDKUnsignedChannelUpdate this_ptr_conv;
8761 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8762 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8763 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
8767 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8768 LDKUnsignedChannelUpdate this_ptr_conv;
8769 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8770 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8771 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
8774 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
8775 LDKUnsignedChannelUpdate this_ptr_conv;
8776 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8777 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8778 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
8782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
8783 LDKUnsignedChannelUpdate this_ptr_conv;
8784 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8785 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8786 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
8789 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
8790 LDKUnsignedChannelUpdate this_ptr_conv;
8791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8793 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
8797 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8798 LDKUnsignedChannelUpdate this_ptr_conv;
8799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8801 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
8804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(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 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
8812 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8813 LDKUnsignedChannelUpdate this_ptr_conv;
8814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8816 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
8819 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(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 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
8827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8828 LDKUnsignedChannelUpdate this_ptr_conv;
8829 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8830 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8831 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
8834 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
8835 LDKUnsignedChannelUpdate this_ptr_conv;
8836 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8837 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8838 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
8842 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8843 LDKUnsignedChannelUpdate this_ptr_conv;
8844 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8845 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8846 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
8849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8850 LDKChannelUpdate this_ptr_conv;
8851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8853 ChannelUpdate_free(this_ptr_conv);
8856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8857 LDKChannelUpdate orig_conv;
8858 orig_conv.inner = (void*)(orig & (~1));
8859 orig_conv.is_owned = (orig & 1) || (orig == 0);
8860 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
8861 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8864 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8865 LDKChannelUpdate this_ptr_conv;
8866 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8867 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8868 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8869 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
8873 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8874 LDKChannelUpdate this_ptr_conv;
8875 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8876 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8877 LDKSignature val_ref;
8878 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8879 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8880 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
8883 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
8884 LDKChannelUpdate 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 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
8888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8892 LDKChannelUpdate 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 LDKUnsignedChannelUpdate val_conv;
8896 val_conv.inner = (void*)(val & (~1));
8897 val_conv.is_owned = (val & 1) || (val == 0);
8898 if (val_conv.inner != NULL)
8899 val_conv = UnsignedChannelUpdate_clone(&val_conv);
8900 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
8903 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
8904 LDKSignature signature_arg_ref;
8905 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8906 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8907 LDKUnsignedChannelUpdate contents_arg_conv;
8908 contents_arg_conv.inner = (void*)(contents_arg & (~1));
8909 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
8910 if (contents_arg_conv.inner != NULL)
8911 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
8912 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
8913 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8916 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8917 LDKQueryChannelRange this_ptr_conv;
8918 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8919 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8920 QueryChannelRange_free(this_ptr_conv);
8923 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8924 LDKQueryChannelRange orig_conv;
8925 orig_conv.inner = (void*)(orig & (~1));
8926 orig_conv.is_owned = (orig & 1) || (orig == 0);
8927 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
8928 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8931 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8932 LDKQueryChannelRange this_ptr_conv;
8933 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8934 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8935 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8936 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
8940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8941 LDKQueryChannelRange this_ptr_conv;
8942 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8943 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8944 LDKThirtyTwoBytes val_ref;
8945 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8946 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8947 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
8950 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
8951 LDKQueryChannelRange this_ptr_conv;
8952 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8953 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8954 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
8958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8959 LDKQueryChannelRange 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 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
8965 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
8966 LDKQueryChannelRange this_ptr_conv;
8967 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8968 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8969 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
8973 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8974 LDKQueryChannelRange this_ptr_conv;
8975 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8976 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8977 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
8980 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) {
8981 LDKThirtyTwoBytes chain_hash_arg_ref;
8982 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
8983 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
8984 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
8985 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8988 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8989 LDKReplyChannelRange this_ptr_conv;
8990 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8991 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8992 ReplyChannelRange_free(this_ptr_conv);
8995 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8996 LDKReplyChannelRange orig_conv;
8997 orig_conv.inner = (void*)(orig & (~1));
8998 orig_conv.is_owned = (orig & 1) || (orig == 0);
8999 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9000 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9003 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9004 LDKReplyChannelRange this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9007 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9008 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9012 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9013 LDKReplyChannelRange this_ptr_conv;
9014 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9015 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9016 LDKThirtyTwoBytes val_ref;
9017 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9018 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9019 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9022 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9023 LDKReplyChannelRange this_ptr_conv;
9024 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9025 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9026 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9031 LDKReplyChannelRange this_ptr_conv;
9032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9034 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9037 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9038 LDKReplyChannelRange this_ptr_conv;
9039 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9040 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9041 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9045 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9046 LDKReplyChannelRange this_ptr_conv;
9047 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9048 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9049 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9052 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9053 LDKReplyChannelRange 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 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9061 LDKReplyChannelRange this_ptr_conv;
9062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9064 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9068 LDKReplyChannelRange 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 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9073 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_conv);
9076 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) {
9077 LDKThirtyTwoBytes chain_hash_arg_ref;
9078 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9079 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9080 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9081 FREE((void*)short_channel_ids_arg);
9082 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_conv);
9083 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9087 LDKQueryShortChannelIds this_ptr_conv;
9088 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9089 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9090 QueryShortChannelIds_free(this_ptr_conv);
9093 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9094 LDKQueryShortChannelIds orig_conv;
9095 orig_conv.inner = (void*)(orig & (~1));
9096 orig_conv.is_owned = (orig & 1) || (orig == 0);
9097 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9098 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9101 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9102 LDKQueryShortChannelIds this_ptr_conv;
9103 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9104 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9105 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9106 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9110 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9111 LDKQueryShortChannelIds this_ptr_conv;
9112 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9113 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9114 LDKThirtyTwoBytes val_ref;
9115 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9116 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9117 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9120 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9121 LDKQueryShortChannelIds this_ptr_conv;
9122 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9123 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9124 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
9126 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_conv);
9129 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlong short_channel_ids_arg) {
9130 LDKThirtyTwoBytes chain_hash_arg_ref;
9131 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9132 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9133 LDKCVec_u64Z short_channel_ids_arg_conv = *(LDKCVec_u64Z*)short_channel_ids_arg;
9134 FREE((void*)short_channel_ids_arg);
9135 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_conv);
9136 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9139 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9140 LDKReplyShortChannelIdsEnd 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 ReplyShortChannelIdsEnd_free(this_ptr_conv);
9146 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9147 LDKReplyShortChannelIdsEnd orig_conv;
9148 orig_conv.inner = (void*)(orig & (~1));
9149 orig_conv.is_owned = (orig & 1) || (orig == 0);
9150 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
9151 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9155 LDKReplyShortChannelIdsEnd 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9159 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
9163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9164 LDKReplyShortChannelIdsEnd this_ptr_conv;
9165 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9166 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9167 LDKThirtyTwoBytes val_ref;
9168 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9169 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9170 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
9173 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9174 LDKReplyShortChannelIdsEnd this_ptr_conv;
9175 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9176 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9177 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
9181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9182 LDKReplyShortChannelIdsEnd this_ptr_conv;
9183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9185 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
9188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
9189 LDKThirtyTwoBytes chain_hash_arg_ref;
9190 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9191 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9192 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
9193 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9197 LDKGossipTimestampFilter this_ptr_conv;
9198 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9199 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9200 GossipTimestampFilter_free(this_ptr_conv);
9203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9204 LDKGossipTimestampFilter orig_conv;
9205 orig_conv.inner = (void*)(orig & (~1));
9206 orig_conv.is_owned = (orig & 1) || (orig == 0);
9207 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
9208 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9211 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9212 LDKGossipTimestampFilter this_ptr_conv;
9213 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9214 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9215 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9216 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
9220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9221 LDKGossipTimestampFilter this_ptr_conv;
9222 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9223 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9224 LDKThirtyTwoBytes val_ref;
9225 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9226 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9227 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
9230 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9231 LDKGossipTimestampFilter this_ptr_conv;
9232 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9233 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9234 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
9238 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9239 LDKGossipTimestampFilter this_ptr_conv;
9240 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9241 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9242 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
9245 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
9246 LDKGossipTimestampFilter this_ptr_conv;
9247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9249 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
9253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9254 LDKGossipTimestampFilter this_ptr_conv;
9255 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9256 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9257 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
9260 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) {
9261 LDKThirtyTwoBytes chain_hash_arg_ref;
9262 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9263 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9264 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
9265 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9269 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
9270 FREE((void*)this_ptr);
9271 ErrorAction_free(this_ptr_conv);
9274 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9275 LDKLightningError this_ptr_conv;
9276 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9277 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9278 LightningError_free(this_ptr_conv);
9281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
9282 LDKLightningError this_ptr_conv;
9283 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9284 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9285 LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
9286 *ret = LightningError_get_err(&this_ptr_conv);
9290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9291 LDKLightningError 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 LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
9296 LightningError_set_err(&this_ptr_conv, val_conv);
9299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
9300 LDKLightningError this_ptr_conv;
9301 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9302 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9303 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
9304 *ret = LightningError_get_action(&this_ptr_conv);
9308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9309 LDKLightningError this_ptr_conv;
9310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9312 LDKErrorAction val_conv = *(LDKErrorAction*)val;
9314 LightningError_set_action(&this_ptr_conv, val_conv);
9317 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
9318 LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
9319 FREE((void*)err_arg);
9320 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
9321 FREE((void*)action_arg);
9322 LDKLightningError ret = LightningError_new(err_arg_conv, action_arg_conv);
9323 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9327 LDKCommitmentUpdate this_ptr_conv;
9328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9330 CommitmentUpdate_free(this_ptr_conv);
9333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9334 LDKCommitmentUpdate orig_conv;
9335 orig_conv.inner = (void*)(orig & (~1));
9336 orig_conv.is_owned = (orig & 1) || (orig == 0);
9337 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
9338 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9342 LDKCommitmentUpdate this_ptr_conv;
9343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9345 LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
9347 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_conv);
9350 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9351 LDKCommitmentUpdate this_ptr_conv;
9352 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9353 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9354 LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
9356 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_conv);
9359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9360 LDKCommitmentUpdate this_ptr_conv;
9361 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9362 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9363 LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
9365 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_conv);
9368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9369 LDKCommitmentUpdate 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 LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
9374 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_conv);
9377 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
9378 LDKCommitmentUpdate this_ptr_conv;
9379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9381 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
9382 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9385 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9386 LDKCommitmentUpdate this_ptr_conv;
9387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9389 LDKUpdateFee val_conv;
9390 val_conv.inner = (void*)(val & (~1));
9391 val_conv.is_owned = (val & 1) || (val == 0);
9392 if (val_conv.inner != NULL)
9393 val_conv = UpdateFee_clone(&val_conv);
9394 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
9397 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
9398 LDKCommitmentUpdate this_ptr_conv;
9399 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9400 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9401 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
9402 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9405 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9406 LDKCommitmentUpdate this_ptr_conv;
9407 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9408 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9409 LDKCommitmentSigned val_conv;
9410 val_conv.inner = (void*)(val & (~1));
9411 val_conv.is_owned = (val & 1) || (val == 0);
9412 if (val_conv.inner != NULL)
9413 val_conv = CommitmentSigned_clone(&val_conv);
9414 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
9417 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) {
9418 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
9419 FREE((void*)update_add_htlcs_arg);
9420 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
9421 FREE((void*)update_fulfill_htlcs_arg);
9422 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
9423 FREE((void*)update_fail_htlcs_arg);
9424 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
9425 FREE((void*)update_fail_malformed_htlcs_arg);
9426 LDKUpdateFee update_fee_arg_conv;
9427 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
9428 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
9429 if (update_fee_arg_conv.inner != NULL)
9430 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
9431 LDKCommitmentSigned commitment_signed_arg_conv;
9432 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
9433 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
9434 if (commitment_signed_arg_conv.inner != NULL)
9435 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
9436 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);
9437 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9441 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
9442 FREE((void*)this_ptr);
9443 HTLCFailChannelUpdate_free(this_ptr_conv);
9446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9447 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
9448 FREE((void*)this_ptr);
9449 ChannelMessageHandler_free(this_ptr_conv);
9452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9453 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
9454 FREE((void*)this_ptr);
9455 RoutingMessageHandler_free(this_ptr_conv);
9458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9459 LDKAcceptChannel obj_conv;
9460 obj_conv.inner = (void*)(obj & (~1));
9461 obj_conv.is_owned = (obj & 1) || (obj == 0);
9462 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9463 *ret = AcceptChannel_write(&obj_conv);
9467 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9469 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9470 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9471 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
9472 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9473 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
9477 LDKAnnouncementSignatures obj_conv;
9478 obj_conv.inner = (void*)(obj & (~1));
9479 obj_conv.is_owned = (obj & 1) || (obj == 0);
9480 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9481 *ret = AnnouncementSignatures_write(&obj_conv);
9485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9487 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9488 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9489 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
9490 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9491 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
9495 LDKChannelReestablish obj_conv;
9496 obj_conv.inner = (void*)(obj & (~1));
9497 obj_conv.is_owned = (obj & 1) || (obj == 0);
9498 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9499 *ret = ChannelReestablish_write(&obj_conv);
9503 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9505 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9506 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9507 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
9508 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9509 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9512 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9513 LDKClosingSigned obj_conv;
9514 obj_conv.inner = (void*)(obj & (~1));
9515 obj_conv.is_owned = (obj & 1) || (obj == 0);
9516 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9517 *ret = ClosingSigned_write(&obj_conv);
9521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9523 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9524 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9525 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
9526 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9527 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9531 LDKCommitmentSigned obj_conv;
9532 obj_conv.inner = (void*)(obj & (~1));
9533 obj_conv.is_owned = (obj & 1) || (obj == 0);
9534 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9535 *ret = CommitmentSigned_write(&obj_conv);
9539 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9541 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9542 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9543 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
9544 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9545 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
9549 LDKFundingCreated obj_conv;
9550 obj_conv.inner = (void*)(obj & (~1));
9551 obj_conv.is_owned = (obj & 1) || (obj == 0);
9552 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9553 *ret = FundingCreated_write(&obj_conv);
9557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9559 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9560 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9561 LDKFundingCreated ret = FundingCreated_read(ser_ref);
9562 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9563 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
9567 LDKFundingSigned obj_conv;
9568 obj_conv.inner = (void*)(obj & (~1));
9569 obj_conv.is_owned = (obj & 1) || (obj == 0);
9570 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9571 *ret = FundingSigned_write(&obj_conv);
9575 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9577 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9578 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9579 LDKFundingSigned ret = FundingSigned_read(ser_ref);
9580 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9581 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9584 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
9585 LDKFundingLocked obj_conv;
9586 obj_conv.inner = (void*)(obj & (~1));
9587 obj_conv.is_owned = (obj & 1) || (obj == 0);
9588 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9589 *ret = FundingLocked_write(&obj_conv);
9593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9595 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9596 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9597 LDKFundingLocked ret = FundingLocked_read(ser_ref);
9598 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9599 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
9604 obj_conv.inner = (void*)(obj & (~1));
9605 obj_conv.is_owned = (obj & 1) || (obj == 0);
9606 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9607 *ret = Init_write(&obj_conv);
9611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9613 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9614 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9615 LDKInit ret = Init_read(ser_ref);
9616 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9617 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9620 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
9621 LDKOpenChannel obj_conv;
9622 obj_conv.inner = (void*)(obj & (~1));
9623 obj_conv.is_owned = (obj & 1) || (obj == 0);
9624 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9625 *ret = OpenChannel_write(&obj_conv);
9629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9631 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9632 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9633 LDKOpenChannel ret = OpenChannel_read(ser_ref);
9634 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9635 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
9639 LDKRevokeAndACK obj_conv;
9640 obj_conv.inner = (void*)(obj & (~1));
9641 obj_conv.is_owned = (obj & 1) || (obj == 0);
9642 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9643 *ret = RevokeAndACK_write(&obj_conv);
9647 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9649 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9650 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9651 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
9652 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9653 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
9657 LDKShutdown obj_conv;
9658 obj_conv.inner = (void*)(obj & (~1));
9659 obj_conv.is_owned = (obj & 1) || (obj == 0);
9660 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9661 *ret = Shutdown_write(&obj_conv);
9665 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9667 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9668 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9669 LDKShutdown ret = Shutdown_read(ser_ref);
9670 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9671 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9674 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9675 LDKUpdateFailHTLC obj_conv;
9676 obj_conv.inner = (void*)(obj & (~1));
9677 obj_conv.is_owned = (obj & 1) || (obj == 0);
9678 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9679 *ret = UpdateFailHTLC_write(&obj_conv);
9683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9685 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9686 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9687 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
9688 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9689 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9693 LDKUpdateFailMalformedHTLC obj_conv;
9694 obj_conv.inner = (void*)(obj & (~1));
9695 obj_conv.is_owned = (obj & 1) || (obj == 0);
9696 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9697 *ret = UpdateFailMalformedHTLC_write(&obj_conv);
9701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9703 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9704 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9705 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
9706 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9707 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
9711 LDKUpdateFee obj_conv;
9712 obj_conv.inner = (void*)(obj & (~1));
9713 obj_conv.is_owned = (obj & 1) || (obj == 0);
9714 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9715 *ret = UpdateFee_write(&obj_conv);
9719 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9721 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9722 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9723 LDKUpdateFee ret = UpdateFee_read(ser_ref);
9724 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9725 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9729 LDKUpdateFulfillHTLC obj_conv;
9730 obj_conv.inner = (void*)(obj & (~1));
9731 obj_conv.is_owned = (obj & 1) || (obj == 0);
9732 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9733 *ret = UpdateFulfillHTLC_write(&obj_conv);
9737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_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 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_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 jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
9747 LDKUpdateAddHTLC obj_conv;
9748 obj_conv.inner = (void*)(obj & (~1));
9749 obj_conv.is_owned = (obj & 1) || (obj == 0);
9750 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9751 *ret = UpdateAddHTLC_write(&obj_conv);
9755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9757 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9758 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9759 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
9760 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
9766 obj_conv.inner = (void*)(obj & (~1));
9767 obj_conv.is_owned = (obj & 1) || (obj == 0);
9768 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9769 *ret = Ping_write(&obj_conv);
9773 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9775 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9776 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9777 LDKPing ret = Ping_read(ser_ref);
9778 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9779 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
9784 obj_conv.inner = (void*)(obj & (~1));
9785 obj_conv.is_owned = (obj & 1) || (obj == 0);
9786 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9787 *ret = Pong_write(&obj_conv);
9791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9793 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9794 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9795 LDKPong ret = Pong_read(ser_ref);
9796 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9797 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9801 LDKUnsignedChannelAnnouncement obj_conv;
9802 obj_conv.inner = (void*)(obj & (~1));
9803 obj_conv.is_owned = (obj & 1) || (obj == 0);
9804 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9805 *ret = UnsignedChannelAnnouncement_write(&obj_conv);
9809 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9811 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9812 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9813 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
9814 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9815 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9818 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9819 LDKChannelAnnouncement obj_conv;
9820 obj_conv.inner = (void*)(obj & (~1));
9821 obj_conv.is_owned = (obj & 1) || (obj == 0);
9822 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9823 *ret = ChannelAnnouncement_write(&obj_conv);
9827 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9829 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9830 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9831 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
9832 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9833 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9836 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9837 LDKUnsignedChannelUpdate obj_conv;
9838 obj_conv.inner = (void*)(obj & (~1));
9839 obj_conv.is_owned = (obj & 1) || (obj == 0);
9840 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9841 *ret = UnsignedChannelUpdate_write(&obj_conv);
9845 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9847 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9848 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9849 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
9850 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9851 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9854 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
9855 LDKChannelUpdate obj_conv;
9856 obj_conv.inner = (void*)(obj & (~1));
9857 obj_conv.is_owned = (obj & 1) || (obj == 0);
9858 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9859 *ret = ChannelUpdate_write(&obj_conv);
9863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9865 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9866 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9867 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
9868 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9869 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
9873 LDKErrorMessage obj_conv;
9874 obj_conv.inner = (void*)(obj & (~1));
9875 obj_conv.is_owned = (obj & 1) || (obj == 0);
9876 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9877 *ret = ErrorMessage_write(&obj_conv);
9881 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9883 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9884 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9885 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
9886 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9887 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9890 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9891 LDKUnsignedNodeAnnouncement obj_conv;
9892 obj_conv.inner = (void*)(obj & (~1));
9893 obj_conv.is_owned = (obj & 1) || (obj == 0);
9894 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9895 *ret = UnsignedNodeAnnouncement_write(&obj_conv);
9899 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9901 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9902 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9903 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
9904 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9905 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9908 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
9909 LDKNodeAnnouncement obj_conv;
9910 obj_conv.inner = (void*)(obj & (~1));
9911 obj_conv.is_owned = (obj & 1) || (obj == 0);
9912 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9913 *ret = NodeAnnouncement_write(&obj_conv);
9917 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9919 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9920 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9921 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
9922 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9923 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9926 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9928 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9929 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9930 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
9931 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9932 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
9936 LDKQueryShortChannelIds obj_conv;
9937 obj_conv.inner = (void*)(obj & (~1));
9938 obj_conv.is_owned = (obj & 1) || (obj == 0);
9939 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9940 *ret = QueryShortChannelIds_write(&obj_conv);
9944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9946 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9947 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9948 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
9949 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
9954 LDKReplyShortChannelIdsEnd obj_conv;
9955 obj_conv.inner = (void*)(obj & (~1));
9956 obj_conv.is_owned = (obj & 1) || (obj == 0);
9957 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9958 *ret = ReplyShortChannelIdsEnd_write(&obj_conv);
9962 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9964 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9965 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9966 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
9967 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9968 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9971 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9972 LDKQueryChannelRange obj_conv;
9973 obj_conv.inner = (void*)(obj & (~1));
9974 obj_conv.is_owned = (obj & 1) || (obj == 0);
9975 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9976 *ret = QueryChannelRange_write(&obj_conv);
9980 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
9982 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
9983 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
9984 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
9985 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
9986 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9989 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
9990 LDKReplyChannelRange obj_conv;
9991 obj_conv.inner = (void*)(obj & (~1));
9992 obj_conv.is_owned = (obj & 1) || (obj == 0);
9993 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
9994 *ret = ReplyChannelRange_write(&obj_conv);
9998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10000 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10001 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10002 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
10003 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10004 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10007 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
10008 LDKGossipTimestampFilter obj_conv;
10009 obj_conv.inner = (void*)(obj & (~1));
10010 obj_conv.is_owned = (obj & 1) || (obj == 0);
10011 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10012 *ret = GossipTimestampFilter_write(&obj_conv);
10016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10017 LDKMessageHandler this_ptr_conv;
10018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10020 MessageHandler_free(this_ptr_conv);
10023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10024 LDKMessageHandler this_ptr_conv;
10025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10027 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
10031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10032 LDKMessageHandler this_ptr_conv;
10033 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10034 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10035 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
10036 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
10037 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10038 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
10040 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
10043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
10044 LDKMessageHandler this_ptr_conv;
10045 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10046 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10047 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
10051 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10052 LDKMessageHandler this_ptr_conv;
10053 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10054 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10055 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
10056 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10057 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10058 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
10060 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
10063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
10064 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
10065 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
10066 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10067 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
10069 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
10070 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
10071 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10072 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
10074 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
10075 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10078 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10079 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
10080 FREE((void*)this_ptr);
10081 SocketDescriptor_free(this_ptr_conv);
10084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10085 LDKPeerHandleError this_ptr_conv;
10086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10088 PeerHandleError_free(this_ptr_conv);
10091 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
10092 LDKPeerHandleError this_ptr_conv;
10093 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10094 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10095 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
10099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10100 LDKPeerHandleError this_ptr_conv;
10101 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10102 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10103 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
10106 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
10107 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
10108 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10112 LDKPeerManager this_ptr_conv;
10113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10115 PeerManager_free(this_ptr_conv);
10118 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) {
10119 LDKMessageHandler message_handler_conv;
10120 message_handler_conv.inner = (void*)(message_handler & (~1));
10121 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
10122 // Warning: we may need a move here but can't clone!
10123 LDKSecretKey our_node_secret_ref;
10124 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
10125 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
10126 unsigned char ephemeral_random_data_arr[32];
10127 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
10128 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
10129 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
10130 LDKLogger logger_conv = *(LDKLogger*)logger;
10131 if (logger_conv.free == LDKLogger_JCalls_free) {
10132 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10133 LDKLogger_JCalls_clone(logger_conv.this_arg);
10135 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
10136 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10139 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
10140 LDKPeerManager this_arg_conv;
10141 this_arg_conv.inner = (void*)(this_arg & (~1));
10142 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10143 LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
10144 *ret = PeerManager_get_peer_node_ids(&this_arg_conv);
10148 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) {
10149 LDKPeerManager this_arg_conv;
10150 this_arg_conv.inner = (void*)(this_arg & (~1));
10151 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10152 LDKPublicKey their_node_id_ref;
10153 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
10154 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
10155 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10156 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10157 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10158 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10160 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
10161 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
10165 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10166 LDKPeerManager this_arg_conv;
10167 this_arg_conv.inner = (void*)(this_arg & (~1));
10168 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10169 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
10170 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
10171 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
10172 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
10174 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10175 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
10179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10180 LDKPeerManager this_arg_conv;
10181 this_arg_conv.inner = (void*)(this_arg & (~1));
10182 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10183 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10184 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
10185 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
10189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
10190 LDKPeerManager this_arg_conv;
10191 this_arg_conv.inner = (void*)(this_arg & (~1));
10192 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10193 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
10194 LDKu8slice data_ref;
10195 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
10196 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
10197 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
10198 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
10199 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
10203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
10204 LDKPeerManager this_arg_conv;
10205 this_arg_conv.inner = (void*)(this_arg & (~1));
10206 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10207 PeerManager_process_events(&this_arg_conv);
10210 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
10211 LDKPeerManager this_arg_conv;
10212 this_arg_conv.inner = (void*)(this_arg & (~1));
10213 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10214 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
10215 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
10218 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
10219 LDKPeerManager this_arg_conv;
10220 this_arg_conv.inner = (void*)(this_arg & (~1));
10221 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10222 PeerManager_timer_tick_occured(&this_arg_conv);
10225 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
10226 unsigned char commitment_seed_arr[32];
10227 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
10228 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
10229 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
10230 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10231 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
10235 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
10236 LDKPublicKey per_commitment_point_ref;
10237 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10238 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10239 unsigned char base_secret_arr[32];
10240 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
10241 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
10242 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
10243 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10244 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
10248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
10249 LDKPublicKey per_commitment_point_ref;
10250 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10251 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10252 LDKPublicKey base_point_ref;
10253 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
10254 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
10255 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10256 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
10260 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) {
10261 unsigned char per_commitment_secret_arr[32];
10262 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
10263 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
10264 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
10265 unsigned char countersignatory_revocation_base_secret_arr[32];
10266 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
10267 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
10268 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
10269 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
10270 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
10274 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) {
10275 LDKPublicKey per_commitment_point_ref;
10276 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10277 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10278 LDKPublicKey countersignatory_revocation_base_point_ref;
10279 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
10280 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
10281 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
10282 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
10286 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10287 LDKTxCreationKeys this_ptr_conv;
10288 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10289 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10290 TxCreationKeys_free(this_ptr_conv);
10293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10294 LDKTxCreationKeys orig_conv;
10295 orig_conv.inner = (void*)(orig & (~1));
10296 orig_conv.is_owned = (orig & 1) || (orig == 0);
10297 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
10298 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10301 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10302 LDKTxCreationKeys this_ptr_conv;
10303 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10304 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10305 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10306 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
10310 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10311 LDKTxCreationKeys this_ptr_conv;
10312 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10313 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10314 LDKPublicKey val_ref;
10315 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10316 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10317 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
10320 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10321 LDKTxCreationKeys this_ptr_conv;
10322 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10323 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10324 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10325 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
10329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10330 LDKTxCreationKeys this_ptr_conv;
10331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10333 LDKPublicKey val_ref;
10334 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10335 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10336 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
10339 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10340 LDKTxCreationKeys this_ptr_conv;
10341 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10342 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10343 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10344 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
10348 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10349 LDKTxCreationKeys this_ptr_conv;
10350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10352 LDKPublicKey val_ref;
10353 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10354 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10355 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
10358 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10359 LDKTxCreationKeys this_ptr_conv;
10360 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10361 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10362 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10363 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
10367 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10368 LDKTxCreationKeys this_ptr_conv;
10369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10371 LDKPublicKey val_ref;
10372 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10373 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10374 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
10377 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
10378 LDKTxCreationKeys this_ptr_conv;
10379 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10380 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10381 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10382 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
10386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10387 LDKTxCreationKeys this_ptr_conv;
10388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10390 LDKPublicKey val_ref;
10391 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10392 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10393 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
10396 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) {
10397 LDKPublicKey per_commitment_point_arg_ref;
10398 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
10399 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
10400 LDKPublicKey revocation_key_arg_ref;
10401 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
10402 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
10403 LDKPublicKey broadcaster_htlc_key_arg_ref;
10404 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
10405 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
10406 LDKPublicKey countersignatory_htlc_key_arg_ref;
10407 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
10408 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
10409 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
10410 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
10411 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
10412 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);
10413 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10416 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10417 LDKTxCreationKeys obj_conv;
10418 obj_conv.inner = (void*)(obj & (~1));
10419 obj_conv.is_owned = (obj & 1) || (obj == 0);
10420 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10421 *ret = TxCreationKeys_write(&obj_conv);
10425 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10426 LDKu8slice ser_ref;
10427 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10428 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10429 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
10430 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10431 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10434 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10435 LDKPreCalculatedTxCreationKeys this_ptr_conv;
10436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10438 PreCalculatedTxCreationKeys_free(this_ptr_conv);
10441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
10442 LDKTxCreationKeys keys_conv;
10443 keys_conv.inner = (void*)(keys & (~1));
10444 keys_conv.is_owned = (keys & 1) || (keys == 0);
10445 if (keys_conv.inner != NULL)
10446 keys_conv = TxCreationKeys_clone(&keys_conv);
10447 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
10448 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10452 LDKPreCalculatedTxCreationKeys this_arg_conv;
10453 this_arg_conv.inner = (void*)(this_arg & (~1));
10454 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10455 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
10456 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10459 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
10460 LDKPreCalculatedTxCreationKeys this_arg_conv;
10461 this_arg_conv.inner = (void*)(this_arg & (~1));
10462 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10463 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10464 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
10468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10469 LDKChannelPublicKeys 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 ChannelPublicKeys_free(this_ptr_conv);
10475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10476 LDKChannelPublicKeys orig_conv;
10477 orig_conv.inner = (void*)(orig & (~1));
10478 orig_conv.is_owned = (orig & 1) || (orig == 0);
10479 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
10480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10484 LDKChannelPublicKeys this_ptr_conv;
10485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10487 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10488 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
10492 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10493 LDKChannelPublicKeys this_ptr_conv;
10494 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10495 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10496 LDKPublicKey val_ref;
10497 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10498 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10499 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
10502 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10503 LDKChannelPublicKeys this_ptr_conv;
10504 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10505 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10506 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10507 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
10511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10512 LDKChannelPublicKeys this_ptr_conv;
10513 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10514 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10515 LDKPublicKey val_ref;
10516 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10517 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10518 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
10521 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
10522 LDKChannelPublicKeys this_ptr_conv;
10523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10525 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10526 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
10530 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10531 LDKChannelPublicKeys this_ptr_conv;
10532 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10533 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10534 LDKPublicKey val_ref;
10535 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10536 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10537 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
10540 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10541 LDKChannelPublicKeys this_ptr_conv;
10542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10544 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10545 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
10549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10550 LDKChannelPublicKeys this_ptr_conv;
10551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10553 LDKPublicKey val_ref;
10554 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10555 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10556 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
10559 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
10560 LDKChannelPublicKeys this_ptr_conv;
10561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10563 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10564 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
10568 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10569 LDKChannelPublicKeys this_ptr_conv;
10570 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10571 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10572 LDKPublicKey val_ref;
10573 CHECK((*_env)->GetArrayLength (_env, val) == 33);
10574 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
10575 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
10578 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) {
10579 LDKPublicKey funding_pubkey_arg_ref;
10580 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
10581 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
10582 LDKPublicKey revocation_basepoint_arg_ref;
10583 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
10584 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
10585 LDKPublicKey payment_point_arg_ref;
10586 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
10587 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
10588 LDKPublicKey delayed_payment_basepoint_arg_ref;
10589 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
10590 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
10591 LDKPublicKey htlc_basepoint_arg_ref;
10592 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
10593 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
10594 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);
10595 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10598 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
10599 LDKChannelPublicKeys obj_conv;
10600 obj_conv.inner = (void*)(obj & (~1));
10601 obj_conv.is_owned = (obj & 1) || (obj == 0);
10602 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10603 *ret = ChannelPublicKeys_write(&obj_conv);
10607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10608 LDKu8slice ser_ref;
10609 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10610 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10611 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
10612 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10613 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10616 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) {
10617 LDKPublicKey per_commitment_point_ref;
10618 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
10619 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
10620 LDKPublicKey broadcaster_delayed_payment_base_ref;
10621 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
10622 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
10623 LDKPublicKey broadcaster_htlc_base_ref;
10624 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
10625 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
10626 LDKPublicKey countersignatory_revocation_base_ref;
10627 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
10628 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
10629 LDKPublicKey countersignatory_htlc_base_ref;
10630 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
10631 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
10632 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
10633 *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);
10637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
10638 LDKPublicKey revocation_key_ref;
10639 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10640 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10641 LDKPublicKey broadcaster_delayed_payment_key_ref;
10642 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10643 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10644 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10645 *ret = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
10649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10650 LDKHTLCOutputInCommitment this_ptr_conv;
10651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10652 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10653 HTLCOutputInCommitment_free(this_ptr_conv);
10656 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10657 LDKHTLCOutputInCommitment orig_conv;
10658 orig_conv.inner = (void*)(orig & (~1));
10659 orig_conv.is_owned = (orig & 1) || (orig == 0);
10660 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
10661 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10664 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
10665 LDKHTLCOutputInCommitment this_ptr_conv;
10666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10668 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
10672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10673 LDKHTLCOutputInCommitment this_ptr_conv;
10674 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10675 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10676 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
10679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
10680 LDKHTLCOutputInCommitment 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 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
10687 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10688 LDKHTLCOutputInCommitment this_ptr_conv;
10689 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10690 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10691 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
10694 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
10695 LDKHTLCOutputInCommitment this_ptr_conv;
10696 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10697 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10698 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
10702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10703 LDKHTLCOutputInCommitment this_ptr_conv;
10704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10706 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
10709 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10710 LDKHTLCOutputInCommitment this_ptr_conv;
10711 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10712 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10713 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10714 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
10718 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10719 LDKHTLCOutputInCommitment this_ptr_conv;
10720 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10721 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10722 LDKThirtyTwoBytes val_ref;
10723 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10724 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10725 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
10728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
10729 LDKHTLCOutputInCommitment obj_conv;
10730 obj_conv.inner = (void*)(obj & (~1));
10731 obj_conv.is_owned = (obj & 1) || (obj == 0);
10732 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10733 *ret = HTLCOutputInCommitment_write(&obj_conv);
10737 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10738 LDKu8slice ser_ref;
10739 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10740 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10741 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
10742 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10743 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10746 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
10747 LDKHTLCOutputInCommitment htlc_conv;
10748 htlc_conv.inner = (void*)(htlc & (~1));
10749 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10750 LDKTxCreationKeys keys_conv;
10751 keys_conv.inner = (void*)(keys & (~1));
10752 keys_conv.is_owned = (keys & 1) || (keys == 0);
10753 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10754 *ret = get_htlc_redeemscript(&htlc_conv, &keys_conv);
10758 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
10759 LDKPublicKey broadcaster_ref;
10760 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
10761 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
10762 LDKPublicKey countersignatory_ref;
10763 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
10764 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
10765 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10766 *ret = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
10770 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) {
10771 unsigned char prev_hash_arr[32];
10772 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
10773 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
10774 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
10775 LDKHTLCOutputInCommitment htlc_conv;
10776 htlc_conv.inner = (void*)(htlc & (~1));
10777 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
10778 LDKPublicKey broadcaster_delayed_payment_key_ref;
10779 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
10780 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
10781 LDKPublicKey revocation_key_ref;
10782 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
10783 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
10784 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10785 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
10789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10790 LDKHolderCommitmentTransaction this_ptr_conv;
10791 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10792 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10793 HolderCommitmentTransaction_free(this_ptr_conv);
10796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10797 LDKHolderCommitmentTransaction orig_conv;
10798 orig_conv.inner = (void*)(orig & (~1));
10799 orig_conv.is_owned = (orig & 1) || (orig == 0);
10800 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
10801 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
10805 LDKHolderCommitmentTransaction 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 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
10809 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
10813 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10814 LDKHolderCommitmentTransaction this_ptr_conv;
10815 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10816 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10817 LDKTransaction val_conv = *(LDKTransaction*)val;
10819 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
10822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
10823 LDKHolderCommitmentTransaction this_ptr_conv;
10824 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10825 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10826 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10827 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
10831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10832 LDKHolderCommitmentTransaction this_ptr_conv;
10833 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10834 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10835 LDKSignature val_ref;
10836 CHECK((*_env)->GetArrayLength (_env, val) == 64);
10837 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
10838 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
10841 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
10842 LDKHolderCommitmentTransaction 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 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
10849 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10850 LDKHolderCommitmentTransaction this_ptr_conv;
10851 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10852 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10853 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
10856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10857 LDKHolderCommitmentTransaction this_ptr_conv;
10858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10860 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
10862 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_conv);
10865 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) {
10866 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
10867 FREE((void*)unsigned_tx);
10868 LDKSignature counterparty_sig_ref;
10869 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
10870 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
10871 LDKPublicKey holder_funding_key_ref;
10872 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
10873 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
10874 LDKPublicKey counterparty_funding_key_ref;
10875 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
10876 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
10877 LDKTxCreationKeys keys_conv;
10878 keys_conv.inner = (void*)(keys & (~1));
10879 keys_conv.is_owned = (keys & 1) || (keys == 0);
10880 if (keys_conv.inner != NULL)
10881 keys_conv = TxCreationKeys_clone(&keys_conv);
10882 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
10883 FREE((void*)htlc_data);
10884 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);
10885 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10888 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
10889 LDKHolderCommitmentTransaction this_arg_conv;
10890 this_arg_conv.inner = (void*)(this_arg & (~1));
10891 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10892 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
10893 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10896 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
10897 LDKHolderCommitmentTransaction this_arg_conv;
10898 this_arg_conv.inner = (void*)(this_arg & (~1));
10899 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10900 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
10901 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
10905 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) {
10906 LDKHolderCommitmentTransaction this_arg_conv;
10907 this_arg_conv.inner = (void*)(this_arg & (~1));
10908 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10909 unsigned char funding_key_arr[32];
10910 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
10911 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
10912 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
10913 LDKu8slice funding_redeemscript_ref;
10914 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
10915 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
10916 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
10917 (*_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);
10918 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
10922 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) {
10923 LDKHolderCommitmentTransaction this_arg_conv;
10924 this_arg_conv.inner = (void*)(this_arg & (~1));
10925 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
10926 unsigned char htlc_base_key_arr[32];
10927 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
10928 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
10929 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
10930 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
10931 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
10935 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
10936 LDKHolderCommitmentTransaction obj_conv;
10937 obj_conv.inner = (void*)(obj & (~1));
10938 obj_conv.is_owned = (obj & 1) || (obj == 0);
10939 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
10940 *ret = HolderCommitmentTransaction_write(&obj_conv);
10944 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10945 LDKu8slice ser_ref;
10946 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10947 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10948 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
10949 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10954 LDKInitFeatures this_ptr_conv;
10955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10957 InitFeatures_free(this_ptr_conv);
10960 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10961 LDKNodeFeatures this_ptr_conv;
10962 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10963 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10964 NodeFeatures_free(this_ptr_conv);
10967 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10968 LDKChannelFeatures this_ptr_conv;
10969 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10970 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10971 ChannelFeatures_free(this_ptr_conv);
10974 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10975 LDKRouteHop this_ptr_conv;
10976 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10977 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10978 RouteHop_free(this_ptr_conv);
10981 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10982 LDKRouteHop orig_conv;
10983 orig_conv.inner = (void*)(orig & (~1));
10984 orig_conv.is_owned = (orig & 1) || (orig == 0);
10985 LDKRouteHop ret = RouteHop_clone(&orig_conv);
10986 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10989 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
10990 LDKRouteHop this_ptr_conv;
10991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10993 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
10994 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
10998 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10999 LDKRouteHop this_ptr_conv;
11000 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11001 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11002 LDKPublicKey val_ref;
11003 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11004 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11005 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
11008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11009 LDKRouteHop this_ptr_conv;
11010 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11011 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11012 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
11013 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11016 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11017 LDKRouteHop this_ptr_conv;
11018 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11019 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11020 LDKNodeFeatures val_conv;
11021 val_conv.inner = (void*)(val & (~1));
11022 val_conv.is_owned = (val & 1) || (val == 0);
11023 // Warning: we may need a move here but can't clone!
11024 RouteHop_set_node_features(&this_ptr_conv, val_conv);
11027 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11028 LDKRouteHop this_ptr_conv;
11029 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11030 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11031 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
11035 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11036 LDKRouteHop this_ptr_conv;
11037 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11038 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11039 RouteHop_set_short_channel_id(&this_ptr_conv, val);
11042 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11043 LDKRouteHop this_ptr_conv;
11044 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11045 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11046 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
11047 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11051 LDKRouteHop this_ptr_conv;
11052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11054 LDKChannelFeatures val_conv;
11055 val_conv.inner = (void*)(val & (~1));
11056 val_conv.is_owned = (val & 1) || (val == 0);
11057 // Warning: we may need a move here but can't clone!
11058 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
11061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11062 LDKRouteHop this_ptr_conv;
11063 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11064 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11065 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
11069 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11070 LDKRouteHop this_ptr_conv;
11071 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11072 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11073 RouteHop_set_fee_msat(&this_ptr_conv, val);
11076 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11077 LDKRouteHop this_ptr_conv;
11078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11080 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
11084 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11085 LDKRouteHop this_ptr_conv;
11086 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11087 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11088 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
11091 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) {
11092 LDKPublicKey pubkey_arg_ref;
11093 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
11094 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
11095 LDKNodeFeatures node_features_arg_conv;
11096 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
11097 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
11098 // Warning: we may need a move here but can't clone!
11099 LDKChannelFeatures channel_features_arg_conv;
11100 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
11101 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
11102 // Warning: we may need a move here but can't clone!
11103 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);
11104 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11108 LDKRoute this_ptr_conv;
11109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11111 Route_free(this_ptr_conv);
11114 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11115 LDKRoute orig_conv;
11116 orig_conv.inner = (void*)(orig & (~1));
11117 orig_conv.is_owned = (orig & 1) || (orig == 0);
11118 LDKRoute ret = Route_clone(&orig_conv);
11119 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11122 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11123 LDKRoute this_ptr_conv;
11124 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11125 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11126 LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
11128 Route_set_paths(&this_ptr_conv, val_conv);
11131 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
11132 LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
11133 FREE((void*)paths_arg);
11134 LDKRoute ret = Route_new(paths_arg_conv);
11135 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11138 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
11140 obj_conv.inner = (void*)(obj & (~1));
11141 obj_conv.is_owned = (obj & 1) || (obj == 0);
11142 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11143 *ret = Route_write(&obj_conv);
11147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11148 LDKu8slice ser_ref;
11149 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11150 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11151 LDKRoute ret = Route_read(ser_ref);
11152 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11153 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11157 LDKRouteHint this_ptr_conv;
11158 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11159 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11160 RouteHint_free(this_ptr_conv);
11163 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11164 LDKRouteHint orig_conv;
11165 orig_conv.inner = (void*)(orig & (~1));
11166 orig_conv.is_owned = (orig & 1) || (orig == 0);
11167 LDKRouteHint ret = RouteHint_clone(&orig_conv);
11168 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11171 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11172 LDKRouteHint 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11176 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
11180 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11181 LDKRouteHint this_ptr_conv;
11182 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11183 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11184 LDKPublicKey val_ref;
11185 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11186 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11187 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
11190 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
11191 LDKRouteHint this_ptr_conv;
11192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11194 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
11198 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11199 LDKRouteHint this_ptr_conv;
11200 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11201 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11202 RouteHint_set_short_channel_id(&this_ptr_conv, val);
11205 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11206 LDKRouteHint 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 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
11210 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11214 LDKRouteHint this_ptr_conv;
11215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11217 LDKRoutingFees val_conv;
11218 val_conv.inner = (void*)(val & (~1));
11219 val_conv.is_owned = (val & 1) || (val == 0);
11220 if (val_conv.inner != NULL)
11221 val_conv = RoutingFees_clone(&val_conv);
11222 RouteHint_set_fees(&this_ptr_conv, val_conv);
11225 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11226 LDKRouteHint this_ptr_conv;
11227 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11228 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11229 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
11233 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11234 LDKRouteHint this_ptr_conv;
11235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11237 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
11240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11241 LDKRouteHint this_ptr_conv;
11242 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11243 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11244 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
11248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11249 LDKRouteHint this_ptr_conv;
11250 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11251 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11252 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
11255 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) {
11256 LDKPublicKey src_node_id_arg_ref;
11257 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
11258 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
11259 LDKRoutingFees fees_arg_conv;
11260 fees_arg_conv.inner = (void*)(fees_arg & (~1));
11261 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
11262 if (fees_arg_conv.inner != NULL)
11263 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
11264 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
11265 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11268 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) {
11269 LDKPublicKey our_node_id_ref;
11270 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
11271 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
11272 LDKNetworkGraph network_conv;
11273 network_conv.inner = (void*)(network & (~1));
11274 network_conv.is_owned = (network & 1) || (network == 0);
11275 LDKPublicKey target_ref;
11276 CHECK((*_env)->GetArrayLength (_env, target) == 33);
11277 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
11278 LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
11279 LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
11280 FREE((void*)last_hops);
11281 LDKLogger logger_conv = *(LDKLogger*)logger;
11282 if (logger_conv.free == LDKLogger_JCalls_free) {
11283 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11284 LDKLogger_JCalls_clone(logger_conv.this_arg);
11286 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
11287 *ret = get_route(our_node_id_ref, &network_conv, target_ref, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
11291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11292 LDKNetworkGraph this_ptr_conv;
11293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11295 NetworkGraph_free(this_ptr_conv);
11298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11299 LDKLockedNetworkGraph this_ptr_conv;
11300 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11301 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11302 LockedNetworkGraph_free(this_ptr_conv);
11305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11306 LDKNetGraphMsgHandler this_ptr_conv;
11307 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11308 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11309 NetGraphMsgHandler_free(this_ptr_conv);
11312 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
11313 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11314 LDKLogger logger_conv = *(LDKLogger*)logger;
11315 if (logger_conv.free == LDKLogger_JCalls_free) {
11316 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11317 LDKLogger_JCalls_clone(logger_conv.this_arg);
11319 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
11320 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11323 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
11324 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
11325 LDKLogger logger_conv = *(LDKLogger*)logger;
11326 if (logger_conv.free == LDKLogger_JCalls_free) {
11327 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11328 LDKLogger_JCalls_clone(logger_conv.this_arg);
11330 LDKNetworkGraph network_graph_conv;
11331 network_graph_conv.inner = (void*)(network_graph & (~1));
11332 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
11333 // Warning: we may need a move here but can't clone!
11334 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
11335 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11339 LDKNetGraphMsgHandler this_arg_conv;
11340 this_arg_conv.inner = (void*)(this_arg & (~1));
11341 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11342 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
11343 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
11347 LDKLockedNetworkGraph this_arg_conv;
11348 this_arg_conv.inner = (void*)(this_arg & (~1));
11349 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11350 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
11351 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11354 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
11355 LDKNetGraphMsgHandler this_arg_conv;
11356 this_arg_conv.inner = (void*)(this_arg & (~1));
11357 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11358 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
11359 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
11363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11364 LDKDirectionalChannelInfo this_ptr_conv;
11365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11367 DirectionalChannelInfo_free(this_ptr_conv);
11370 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11371 LDKDirectionalChannelInfo 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 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
11378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11379 LDKDirectionalChannelInfo this_ptr_conv;
11380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11382 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
11385 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
11386 LDKDirectionalChannelInfo 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 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
11393 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11394 LDKDirectionalChannelInfo this_ptr_conv;
11395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11397 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
11400 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
11401 LDKDirectionalChannelInfo this_ptr_conv;
11402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11404 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
11408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
11409 LDKDirectionalChannelInfo this_ptr_conv;
11410 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11411 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11412 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
11415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11416 LDKDirectionalChannelInfo this_ptr_conv;
11417 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11418 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11419 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
11423 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11424 LDKDirectionalChannelInfo this_ptr_conv;
11425 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11426 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11427 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
11430 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11431 LDKDirectionalChannelInfo this_ptr_conv;
11432 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11433 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11434 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
11435 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11439 LDKDirectionalChannelInfo this_ptr_conv;
11440 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11441 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11442 LDKChannelUpdate val_conv;
11443 val_conv.inner = (void*)(val & (~1));
11444 val_conv.is_owned = (val & 1) || (val == 0);
11445 if (val_conv.inner != NULL)
11446 val_conv = ChannelUpdate_clone(&val_conv);
11447 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
11450 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11451 LDKDirectionalChannelInfo obj_conv;
11452 obj_conv.inner = (void*)(obj & (~1));
11453 obj_conv.is_owned = (obj & 1) || (obj == 0);
11454 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11455 *ret = DirectionalChannelInfo_write(&obj_conv);
11459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11460 LDKu8slice ser_ref;
11461 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11462 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11463 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
11464 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11465 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11469 LDKChannelInfo this_ptr_conv;
11470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11472 ChannelInfo_free(this_ptr_conv);
11475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11476 LDKChannelInfo this_ptr_conv;
11477 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11478 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11479 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
11480 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11483 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11484 LDKChannelInfo this_ptr_conv;
11485 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11486 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11487 LDKChannelFeatures val_conv;
11488 val_conv.inner = (void*)(val & (~1));
11489 val_conv.is_owned = (val & 1) || (val == 0);
11490 // Warning: we may need a move here but can't clone!
11491 ChannelInfo_set_features(&this_ptr_conv, val_conv);
11494 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11495 LDKChannelInfo this_ptr_conv;
11496 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11497 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11498 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11499 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
11503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11504 LDKChannelInfo this_ptr_conv;
11505 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11506 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11507 LDKPublicKey val_ref;
11508 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11509 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11510 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
11513 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11514 LDKChannelInfo this_ptr_conv;
11515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11517 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
11518 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11522 LDKChannelInfo this_ptr_conv;
11523 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11524 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11525 LDKDirectionalChannelInfo val_conv;
11526 val_conv.inner = (void*)(val & (~1));
11527 val_conv.is_owned = (val & 1) || (val == 0);
11528 // Warning: we may need a move here but can't clone!
11529 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
11532 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
11533 LDKChannelInfo this_ptr_conv;
11534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11536 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11537 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
11541 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11542 LDKChannelInfo this_ptr_conv;
11543 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11544 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11545 LDKPublicKey val_ref;
11546 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11547 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11548 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
11551 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
11552 LDKChannelInfo this_ptr_conv;
11553 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11554 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11555 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
11556 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11559 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11560 LDKChannelInfo this_ptr_conv;
11561 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11562 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11563 LDKDirectionalChannelInfo val_conv;
11564 val_conv.inner = (void*)(val & (~1));
11565 val_conv.is_owned = (val & 1) || (val == 0);
11566 // Warning: we may need a move here but can't clone!
11567 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
11570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11571 LDKChannelInfo this_ptr_conv;
11572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11574 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
11575 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11578 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11579 LDKChannelInfo this_ptr_conv;
11580 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11581 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11582 LDKChannelAnnouncement val_conv;
11583 val_conv.inner = (void*)(val & (~1));
11584 val_conv.is_owned = (val & 1) || (val == 0);
11585 if (val_conv.inner != NULL)
11586 val_conv = ChannelAnnouncement_clone(&val_conv);
11587 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
11590 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11591 LDKChannelInfo obj_conv;
11592 obj_conv.inner = (void*)(obj & (~1));
11593 obj_conv.is_owned = (obj & 1) || (obj == 0);
11594 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11595 *ret = ChannelInfo_write(&obj_conv);
11599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11600 LDKu8slice ser_ref;
11601 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11602 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11603 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
11604 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11605 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11608 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11609 LDKRoutingFees this_ptr_conv;
11610 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11611 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11612 RoutingFees_free(this_ptr_conv);
11615 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11616 LDKRoutingFees orig_conv;
11617 orig_conv.inner = (void*)(orig & (~1));
11618 orig_conv.is_owned = (orig & 1) || (orig == 0);
11619 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
11620 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11623 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11624 LDKRoutingFees this_ptr_conv;
11625 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11626 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11627 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
11631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11632 LDKRoutingFees this_ptr_conv;
11633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11635 RoutingFees_set_base_msat(&this_ptr_conv, val);
11638 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
11639 LDKRoutingFees this_ptr_conv;
11640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11642 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
11646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11647 LDKRoutingFees this_ptr_conv;
11648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11650 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
11653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
11654 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
11655 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11658 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11659 LDKu8slice ser_ref;
11660 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11661 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11662 LDKRoutingFees ret = RoutingFees_read(ser_ref);
11663 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11664 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
11668 LDKRoutingFees obj_conv;
11669 obj_conv.inner = (void*)(obj & (~1));
11670 obj_conv.is_owned = (obj & 1) || (obj == 0);
11671 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11672 *ret = RoutingFees_write(&obj_conv);
11676 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11677 LDKNodeAnnouncementInfo this_ptr_conv;
11678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11680 NodeAnnouncementInfo_free(this_ptr_conv);
11683 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
11684 LDKNodeAnnouncementInfo this_ptr_conv;
11685 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11686 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11687 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
11688 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11691 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11692 LDKNodeAnnouncementInfo this_ptr_conv;
11693 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11694 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11695 LDKNodeFeatures val_conv;
11696 val_conv.inner = (void*)(val & (~1));
11697 val_conv.is_owned = (val & 1) || (val == 0);
11698 // Warning: we may need a move here but can't clone!
11699 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
11702 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
11703 LDKNodeAnnouncementInfo this_ptr_conv;
11704 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11705 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11706 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
11710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11711 LDKNodeAnnouncementInfo this_ptr_conv;
11712 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11713 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11714 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
11717 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
11718 LDKNodeAnnouncementInfo this_ptr_conv;
11719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11721 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
11722 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
11726 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11727 LDKNodeAnnouncementInfo this_ptr_conv;
11728 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11729 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11730 LDKThreeBytes val_ref;
11731 CHECK((*_env)->GetArrayLength (_env, val) == 3);
11732 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
11733 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
11736 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
11737 LDKNodeAnnouncementInfo this_ptr_conv;
11738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11740 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11741 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
11745 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11746 LDKNodeAnnouncementInfo this_ptr_conv;
11747 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11748 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11749 LDKThirtyTwoBytes val_ref;
11750 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11751 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11752 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
11755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11756 LDKNodeAnnouncementInfo this_ptr_conv;
11757 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11758 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11759 LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
11761 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_conv);
11764 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
11765 LDKNodeAnnouncementInfo this_ptr_conv;
11766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11768 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
11769 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11773 LDKNodeAnnouncementInfo this_ptr_conv;
11774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11776 LDKNodeAnnouncement val_conv;
11777 val_conv.inner = (void*)(val & (~1));
11778 val_conv.is_owned = (val & 1) || (val == 0);
11779 if (val_conv.inner != NULL)
11780 val_conv = NodeAnnouncement_clone(&val_conv);
11781 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
11784 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) {
11785 LDKNodeFeatures features_arg_conv;
11786 features_arg_conv.inner = (void*)(features_arg & (~1));
11787 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
11788 // Warning: we may need a move here but can't clone!
11789 LDKThreeBytes rgb_arg_ref;
11790 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
11791 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
11792 LDKThirtyTwoBytes alias_arg_ref;
11793 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
11794 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
11795 LDKCVec_NetAddressZ addresses_arg_conv = *(LDKCVec_NetAddressZ*)addresses_arg;
11796 FREE((void*)addresses_arg);
11797 LDKNodeAnnouncement announcement_message_arg_conv;
11798 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
11799 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
11800 if (announcement_message_arg_conv.inner != NULL)
11801 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
11802 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_conv, announcement_message_arg_conv);
11803 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11807 LDKNodeAnnouncementInfo obj_conv;
11808 obj_conv.inner = (void*)(obj & (~1));
11809 obj_conv.is_owned = (obj & 1) || (obj == 0);
11810 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11811 *ret = NodeAnnouncementInfo_write(&obj_conv);
11815 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11816 LDKu8slice ser_ref;
11817 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11818 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11819 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
11820 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11821 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11824 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11825 LDKNodeInfo this_ptr_conv;
11826 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11827 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11828 NodeInfo_free(this_ptr_conv);
11831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11832 LDKNodeInfo 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 LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
11837 NodeInfo_set_channels(&this_ptr_conv, val_conv);
11840 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
11841 LDKNodeInfo this_ptr_conv;
11842 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11843 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11844 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
11845 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11849 LDKNodeInfo this_ptr_conv;
11850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11852 LDKRoutingFees val_conv;
11853 val_conv.inner = (void*)(val & (~1));
11854 val_conv.is_owned = (val & 1) || (val == 0);
11855 if (val_conv.inner != NULL)
11856 val_conv = RoutingFees_clone(&val_conv);
11857 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
11860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
11861 LDKNodeInfo this_ptr_conv;
11862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11864 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
11865 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11868 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11869 LDKNodeInfo this_ptr_conv;
11870 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11871 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11872 LDKNodeAnnouncementInfo val_conv;
11873 val_conv.inner = (void*)(val & (~1));
11874 val_conv.is_owned = (val & 1) || (val == 0);
11875 // Warning: we may need a move here but can't clone!
11876 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
11879 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) {
11880 LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
11881 FREE((void*)channels_arg);
11882 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
11883 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
11884 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
11885 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
11886 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
11887 LDKNodeAnnouncementInfo announcement_info_arg_conv;
11888 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
11889 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
11890 // Warning: we may need a move here but can't clone!
11891 LDKNodeInfo ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
11892 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11895 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
11896 LDKNodeInfo obj_conv;
11897 obj_conv.inner = (void*)(obj & (~1));
11898 obj_conv.is_owned = (obj & 1) || (obj == 0);
11899 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11900 *ret = NodeInfo_write(&obj_conv);
11904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11905 LDKu8slice ser_ref;
11906 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11907 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11908 LDKNodeInfo ret = NodeInfo_read(ser_ref);
11909 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11910 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11913 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
11914 LDKNetworkGraph obj_conv;
11915 obj_conv.inner = (void*)(obj & (~1));
11916 obj_conv.is_owned = (obj & 1) || (obj == 0);
11917 LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
11918 *ret = NetworkGraph_write(&obj_conv);
11922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11923 LDKu8slice ser_ref;
11924 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11925 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11926 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
11927 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11928 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11931 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
11932 LDKNetworkGraph ret = NetworkGraph_new();
11933 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11936 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) {
11937 LDKNetworkGraph this_arg_conv;
11938 this_arg_conv.inner = (void*)(this_arg & (~1));
11939 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11940 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);