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) {
64 if ((long)ptr < 1024) return; // Rust loves to create pointers to the NULL page for dummys
69 void* __wrap_malloc(size_t len) {
70 void* res = __real_malloc(len);
71 new_allocation(res, "malloc call");
74 void* __wrap_calloc(size_t nmemb, size_t len) {
75 void* res = __real_calloc(nmemb, len);
76 new_allocation(res, "calloc call");
79 void __wrap_free(void* ptr) {
84 void* __real_realloc(void* ptr, size_t newlen);
85 void* __wrap_realloc(void* ptr, size_t len) {
87 void* res = __real_realloc(ptr, len);
88 new_allocation(res, "realloc call");
91 void __wrap_reallocarray(void* ptr, size_t new_sz) {
92 // Rust doesn't seem to use reallocarray currently
96 void __attribute__((destructor)) check_leaks() {
97 for (allocation* a = allocation_ll; a != NULL; a = a->next) {
98 fprintf(stderr, "%s %p remains:\n", a->struct_name, a->ptr);
99 backtrace_symbols_fd(a->bt, a->bt_len, STDERR_FILENO);
100 fprintf(stderr, "\n\n");
102 DO_ASSERT(allocation_ll == NULL);
105 static jmethodID ordinal_meth = NULL;
106 static jmethodID slicedef_meth = NULL;
107 static jclass slicedef_cls = NULL;
108 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class, jclass slicedef_class) {
109 ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
110 CHECK(ordinal_meth != NULL);
111 slicedef_meth = (*env)->GetMethodID(env, slicedef_class, "<init>", "(JJJ)V");
112 CHECK(slicedef_meth != NULL);
113 slicedef_cls = (*env)->NewGlobalRef(env, slicedef_class);
114 CHECK(slicedef_cls != NULL);
117 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_deref_1bool (JNIEnv * env, jclass _a, jlong ptr) {
118 return *((bool*)ptr);
120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_deref_1long (JNIEnv * env, jclass _a, jlong ptr) {
121 return *((long*)ptr);
123 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_free_1heap_1ptr (JNIEnv * env, jclass _a, jlong ptr) {
126 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_read_1bytes (JNIEnv * _env, jclass _b, jlong ptr, jlong len) {
127 jbyteArray ret_arr = (*_env)->NewByteArray(_env, len);
128 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, len, (unsigned char*)ptr);
131 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1u8_1slice_1bytes (JNIEnv * _env, jclass _b, jlong slice_ptr) {
132 LDKu8slice *slice = (LDKu8slice*)slice_ptr;
133 jbyteArray ret_arr = (*_env)->NewByteArray(_env, slice->datalen);
134 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, slice->datalen, slice->data);
137 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_bytes_1to_1u8_1vec (JNIEnv * _env, jclass _b, jbyteArray bytes) {
138 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8");
139 vec->datalen = (*_env)->GetArrayLength(_env, bytes);
140 vec->data = (uint8_t*)MALLOC(vec->datalen, "LDKCVec_u8Z Bytes");
141 (*_env)->GetByteArrayRegion (_env, bytes, 0, vec->datalen, vec->data);
144 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1txpointer_1copy_1data (JNIEnv * env, jclass _b, jbyteArray bytes) {
145 LDKTransaction *txdata = (LDKTransaction*)MALLOC(sizeof(LDKTransaction), "LDKTransaction");
146 txdata->datalen = (*env)->GetArrayLength(env, bytes);
147 txdata->data = (uint8_t*)MALLOC(txdata->datalen, "Tx Data Bytes");
148 txdata->data_is_owned = true;
149 (*env)->GetByteArrayRegion (env, bytes, 0, txdata->datalen, txdata->data);
152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_vec_1slice_1len (JNIEnv * env, jclass _a, jlong ptr) {
153 // Check offsets of a few Vec types are all consistent as we're meant to be generic across types
154 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_SignatureZ, datalen), "Vec<*> needs to be mapped identically");
155 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_MessageSendEventZ, datalen), "Vec<*> needs to be mapped identically");
156 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_EventZ, datalen), "Vec<*> needs to be mapped identically");
157 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKCVec_C2Tuple_usizeTransactionZZ, datalen), "Vec<*> needs to be mapped identically");
158 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)ptr;
159 return (long)vec->datalen;
161 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_new_1empty_1slice_1vec (JNIEnv * _env, jclass _b) {
162 // Check sizes of a few Vec types are all consistent as we're meant to be generic across types
163 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_SignatureZ), "Vec<*> needs to be mapped identically");
164 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_MessageSendEventZ), "Vec<*> needs to be mapped identically");
165 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_EventZ), "Vec<*> needs to be mapped identically");
166 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKCVec_C2Tuple_usizeTransactionZZ), "Vec<*> needs to be mapped identically");
167 LDKCVec_u8Z *vec = (LDKCVec_u8Z*)MALLOC(sizeof(LDKCVec_u8Z), "Empty LDKCVec");
173 // We assume that CVec_u8Z and u8slice are the same size and layout (and thus pointers to the two can be mixed)
174 _Static_assert(sizeof(LDKCVec_u8Z) == sizeof(LDKu8slice), "Vec<u8> and [u8] need to have been mapped identically");
175 _Static_assert(offsetof(LDKCVec_u8Z, data) == offsetof(LDKu8slice, data), "Vec<u8> and [u8] need to have been mapped identically");
176 _Static_assert(offsetof(LDKCVec_u8Z, datalen) == offsetof(LDKu8slice, datalen), "Vec<u8> and [u8] need to have been mapped identically");
178 static inline LDKAccessError LDKAccessError_from_java(JNIEnv *env, jclass val) {
179 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
180 case 0: return LDKAccessError_UnknownChain;
181 case 1: return LDKAccessError_UnknownTx;
185 static jclass LDKAccessError_class = NULL;
186 static jfieldID LDKAccessError_LDKAccessError_UnknownChain = NULL;
187 static jfieldID LDKAccessError_LDKAccessError_UnknownTx = NULL;
188 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKAccessError_init (JNIEnv * env, jclass clz) {
189 LDKAccessError_class = (*env)->NewGlobalRef(env, clz);
190 CHECK(LDKAccessError_class != NULL);
191 LDKAccessError_LDKAccessError_UnknownChain = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownChain", "Lorg/ldk/enums/LDKAccessError;");
192 CHECK(LDKAccessError_LDKAccessError_UnknownChain != NULL);
193 LDKAccessError_LDKAccessError_UnknownTx = (*env)->GetStaticFieldID(env, LDKAccessError_class, "LDKAccessError_UnknownTx", "Lorg/ldk/enums/LDKAccessError;");
194 CHECK(LDKAccessError_LDKAccessError_UnknownTx != NULL);
196 static inline jclass LDKAccessError_to_java(JNIEnv *env, LDKAccessError val) {
198 case LDKAccessError_UnknownChain:
199 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownChain);
200 case LDKAccessError_UnknownTx:
201 return (*env)->GetStaticObjectField(env, LDKAccessError_class, LDKAccessError_LDKAccessError_UnknownTx);
206 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
207 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
208 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
209 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
213 static jclass LDKChannelMonitorUpdateErr_class = NULL;
214 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = NULL;
215 static jfieldID LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = NULL;
216 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKChannelMonitorUpdateErr_init (JNIEnv * env, jclass clz) {
217 LDKChannelMonitorUpdateErr_class = (*env)->NewGlobalRef(env, clz);
218 CHECK(LDKChannelMonitorUpdateErr_class != NULL);
219 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
220 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure != NULL);
221 LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure = (*env)->GetStaticFieldID(env, LDKChannelMonitorUpdateErr_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/enums/LDKChannelMonitorUpdateErr;");
222 CHECK(LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure != NULL);
224 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
226 case LDKChannelMonitorUpdateErr_TemporaryFailure:
227 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_TemporaryFailure);
228 case LDKChannelMonitorUpdateErr_PermanentFailure:
229 return (*env)->GetStaticObjectField(env, LDKChannelMonitorUpdateErr_class, LDKChannelMonitorUpdateErr_LDKChannelMonitorUpdateErr_PermanentFailure);
234 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
235 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
236 case 0: return LDKConfirmationTarget_Background;
237 case 1: return LDKConfirmationTarget_Normal;
238 case 2: return LDKConfirmationTarget_HighPriority;
242 static jclass LDKConfirmationTarget_class = NULL;
243 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Background = NULL;
244 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_Normal = NULL;
245 static jfieldID LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = NULL;
246 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKConfirmationTarget_init (JNIEnv * env, jclass clz) {
247 LDKConfirmationTarget_class = (*env)->NewGlobalRef(env, clz);
248 CHECK(LDKConfirmationTarget_class != NULL);
249 LDKConfirmationTarget_LDKConfirmationTarget_Background = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Background", "Lorg/ldk/enums/LDKConfirmationTarget;");
250 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Background != NULL);
251 LDKConfirmationTarget_LDKConfirmationTarget_Normal = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/enums/LDKConfirmationTarget;");
252 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_Normal != NULL);
253 LDKConfirmationTarget_LDKConfirmationTarget_HighPriority = (*env)->GetStaticFieldID(env, LDKConfirmationTarget_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/enums/LDKConfirmationTarget;");
254 CHECK(LDKConfirmationTarget_LDKConfirmationTarget_HighPriority != NULL);
256 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
258 case LDKConfirmationTarget_Background:
259 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Background);
260 case LDKConfirmationTarget_Normal:
261 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_Normal);
262 case LDKConfirmationTarget_HighPriority:
263 return (*env)->GetStaticObjectField(env, LDKConfirmationTarget_class, LDKConfirmationTarget_LDKConfirmationTarget_HighPriority);
268 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
269 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
270 case 0: return LDKLevel_Off;
271 case 1: return LDKLevel_Error;
272 case 2: return LDKLevel_Warn;
273 case 3: return LDKLevel_Info;
274 case 4: return LDKLevel_Debug;
275 case 5: return LDKLevel_Trace;
279 static jclass LDKLevel_class = NULL;
280 static jfieldID LDKLevel_LDKLevel_Off = NULL;
281 static jfieldID LDKLevel_LDKLevel_Error = NULL;
282 static jfieldID LDKLevel_LDKLevel_Warn = NULL;
283 static jfieldID LDKLevel_LDKLevel_Info = NULL;
284 static jfieldID LDKLevel_LDKLevel_Debug = NULL;
285 static jfieldID LDKLevel_LDKLevel_Trace = NULL;
286 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKLevel_init (JNIEnv * env, jclass clz) {
287 LDKLevel_class = (*env)->NewGlobalRef(env, clz);
288 CHECK(LDKLevel_class != NULL);
289 LDKLevel_LDKLevel_Off = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Off", "Lorg/ldk/enums/LDKLevel;");
290 CHECK(LDKLevel_LDKLevel_Off != NULL);
291 LDKLevel_LDKLevel_Error = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Error", "Lorg/ldk/enums/LDKLevel;");
292 CHECK(LDKLevel_LDKLevel_Error != NULL);
293 LDKLevel_LDKLevel_Warn = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Warn", "Lorg/ldk/enums/LDKLevel;");
294 CHECK(LDKLevel_LDKLevel_Warn != NULL);
295 LDKLevel_LDKLevel_Info = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Info", "Lorg/ldk/enums/LDKLevel;");
296 CHECK(LDKLevel_LDKLevel_Info != NULL);
297 LDKLevel_LDKLevel_Debug = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Debug", "Lorg/ldk/enums/LDKLevel;");
298 CHECK(LDKLevel_LDKLevel_Debug != NULL);
299 LDKLevel_LDKLevel_Trace = (*env)->GetStaticFieldID(env, LDKLevel_class, "LDKLevel_Trace", "Lorg/ldk/enums/LDKLevel;");
300 CHECK(LDKLevel_LDKLevel_Trace != NULL);
302 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
305 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Off);
307 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Error);
309 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Warn);
311 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Info);
313 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Debug);
315 return (*env)->GetStaticObjectField(env, LDKLevel_class, LDKLevel_LDKLevel_Trace);
320 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
321 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
322 case 0: return LDKNetwork_Bitcoin;
323 case 1: return LDKNetwork_Testnet;
324 case 2: return LDKNetwork_Regtest;
328 static jclass LDKNetwork_class = NULL;
329 static jfieldID LDKNetwork_LDKNetwork_Bitcoin = NULL;
330 static jfieldID LDKNetwork_LDKNetwork_Testnet = NULL;
331 static jfieldID LDKNetwork_LDKNetwork_Regtest = NULL;
332 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKNetwork_init (JNIEnv * env, jclass clz) {
333 LDKNetwork_class = (*env)->NewGlobalRef(env, clz);
334 CHECK(LDKNetwork_class != NULL);
335 LDKNetwork_LDKNetwork_Bitcoin = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Bitcoin", "Lorg/ldk/enums/LDKNetwork;");
336 CHECK(LDKNetwork_LDKNetwork_Bitcoin != NULL);
337 LDKNetwork_LDKNetwork_Testnet = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Testnet", "Lorg/ldk/enums/LDKNetwork;");
338 CHECK(LDKNetwork_LDKNetwork_Testnet != NULL);
339 LDKNetwork_LDKNetwork_Regtest = (*env)->GetStaticFieldID(env, LDKNetwork_class, "LDKNetwork_Regtest", "Lorg/ldk/enums/LDKNetwork;");
340 CHECK(LDKNetwork_LDKNetwork_Regtest != NULL);
342 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
344 case LDKNetwork_Bitcoin:
345 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Bitcoin);
346 case LDKNetwork_Testnet:
347 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Testnet);
348 case LDKNetwork_Regtest:
349 return (*env)->GetStaticObjectField(env, LDKNetwork_class, LDKNetwork_LDKNetwork_Regtest);
354 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
355 switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
356 case 0: return LDKSecp256k1Error_IncorrectSignature;
357 case 1: return LDKSecp256k1Error_InvalidMessage;
358 case 2: return LDKSecp256k1Error_InvalidPublicKey;
359 case 3: return LDKSecp256k1Error_InvalidSignature;
360 case 4: return LDKSecp256k1Error_InvalidSecretKey;
361 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
362 case 6: return LDKSecp256k1Error_InvalidTweak;
363 case 7: return LDKSecp256k1Error_NotEnoughMemory;
364 case 8: return LDKSecp256k1Error_CallbackPanicked;
368 static jclass LDKSecp256k1Error_class = NULL;
369 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = NULL;
370 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = NULL;
371 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = NULL;
372 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = NULL;
373 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = NULL;
374 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = NULL;
375 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = NULL;
376 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = NULL;
377 static jfieldID LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = NULL;
378 JNIEXPORT void JNICALL Java_org_ldk_enums_LDKSecp256k1Error_init (JNIEnv * env, jclass clz) {
379 LDKSecp256k1Error_class = (*env)->NewGlobalRef(env, clz);
380 CHECK(LDKSecp256k1Error_class != NULL);
381 LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
382 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature != NULL);
383 LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/enums/LDKSecp256k1Error;");
384 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage != NULL);
385 LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
386 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey != NULL);
387 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/enums/LDKSecp256k1Error;");
388 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature != NULL);
389 LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/enums/LDKSecp256k1Error;");
390 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey != NULL);
391 LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/enums/LDKSecp256k1Error;");
392 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId != NULL);
393 LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/enums/LDKSecp256k1Error;");
394 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak != NULL);
395 LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/enums/LDKSecp256k1Error;");
396 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory != NULL);
397 LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked = (*env)->GetStaticFieldID(env, LDKSecp256k1Error_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/enums/LDKSecp256k1Error;");
398 CHECK(LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked != NULL);
400 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
402 case LDKSecp256k1Error_IncorrectSignature:
403 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_IncorrectSignature);
404 case LDKSecp256k1Error_InvalidMessage:
405 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidMessage);
406 case LDKSecp256k1Error_InvalidPublicKey:
407 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidPublicKey);
408 case LDKSecp256k1Error_InvalidSignature:
409 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSignature);
410 case LDKSecp256k1Error_InvalidSecretKey:
411 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidSecretKey);
412 case LDKSecp256k1Error_InvalidRecoveryId:
413 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidRecoveryId);
414 case LDKSecp256k1Error_InvalidTweak:
415 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_InvalidTweak);
416 case LDKSecp256k1Error_NotEnoughMemory:
417 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_NotEnoughMemory);
418 case LDKSecp256k1Error_CallbackPanicked:
419 return (*env)->GetStaticObjectField(env, LDKSecp256k1Error_class, LDKSecp256k1Error_LDKSecp256k1Error_CallbackPanicked);
424 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
425 LDKCVecTempl_u8 *vec = (LDKCVecTempl_u8*)ptr;
426 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint8_t));
428 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u8_1new(JNIEnv *env, jclass _b, jbyteArray elems){
429 LDKCVecTempl_u8 *ret = MALLOC(sizeof(LDKCVecTempl_u8), "LDKCVecTempl_u8");
430 ret->datalen = (*env)->GetArrayLength(env, elems);
431 if (ret->datalen == 0) {
434 ret->data = MALLOC(sizeof(uint8_t) * ret->datalen, "LDKCVecTempl_u8 Data");
435 jbyte *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
436 for (size_t i = 0; i < ret->datalen; i++) {
437 ret->data[i] = java_elems[i];
439 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
443 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
444 LDKC2TupleTempl_usize__Transaction* ret = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction), "LDKC2TupleTempl_usize__Transaction");
446 LDKTransaction b_conv = *(LDKTransaction*)b;
451 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
452 return ((LDKCResult_NoneChannelMonitorUpdateErrZ*)arg)->result_ok;
454 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
455 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
456 CHECK(val->result_ok);
457 return *val->contents.result;
459 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneChannelMonitorUpdateErrZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
460 LDKCResult_NoneChannelMonitorUpdateErrZ *val = (LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
461 CHECK(!val->result_ok);
462 jclass err_conv = LDKChannelMonitorUpdateErr_to_java(_env, (*val->contents.err));
465 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
466 return ((LDKCResult_NoneMonitorUpdateErrorZ*)arg)->result_ok;
468 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
469 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
470 CHECK(val->result_ok);
471 return *val->contents.result;
473 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneMonitorUpdateErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
474 LDKCResult_NoneMonitorUpdateErrorZ *val = (LDKCResult_NoneMonitorUpdateErrorZ*)arg;
475 CHECK(!val->result_ok);
476 LDKMonitorUpdateError err_var = (*val->contents.err);
477 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
478 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
480 if (err_var.is_owned) {
481 err_ref = (long)err_var.inner | 1;
483 err_ref = (long)&err_var;
487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1OutPoint_1_1CVec_1u8Z_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
488 LDKC2TupleTempl_OutPoint__CVec_u8Z* ret = MALLOC(sizeof(LDKC2TupleTempl_OutPoint__CVec_u8Z), "LDKC2TupleTempl_OutPoint__CVec_u8Z");
490 a_conv.inner = (void*)(a & (~1));
491 a_conv.is_owned = (a & 1) || (a == 0);
492 if (a_conv.inner != NULL)
493 a_conv = OutPoint_clone(&a_conv);
496 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
497 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
499 //TODO: Really need to call (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0); here
502 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
503 LDKCVecTempl_TxOut *vec = (LDKCVecTempl_TxOut*)ptr;
504 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTxOut));
506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
507 LDKCVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_TxOut), "LDKCVecTempl_TxOut");
508 ret->datalen = (*env)->GetArrayLength(env, elems);
509 if (ret->datalen == 0) {
512 ret->data = MALLOC(sizeof(LDKTxOut) * ret->datalen, "LDKCVecTempl_TxOut Data");
513 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
514 for (size_t i = 0; i < ret->datalen; i++) {
515 jlong arr_elem = java_elems[i];
516 LDKTxOut arr_elem_conv = *(LDKTxOut*)arr_elem;
517 FREE((void*)arr_elem);
518 ret->data[i] = arr_elem_conv;
520 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *_env, jclass _b, jbyteArray a, jlongArray b) {
525 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut* ret = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
526 LDKThirtyTwoBytes a_ref;
527 CHECK((*_env)->GetArrayLength (_env, a) == 32);
528 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
530 LDKCVecTempl_TxOut b_constr;
531 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
532 if (b_constr.datalen > 0)
533 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVecTempl_TxOut Elements");
535 b_constr.data = NULL;
536 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
537 for (size_t h = 0; h < b_constr.datalen; h++) {
538 long arr_conv_7 = b_vals[h];
539 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
540 FREE((void*)arr_conv_7);
541 b_constr.data[h] = arr_conv_7_conv;
543 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1u64_1_1u64_1new(JNIEnv *_env, jclass _b, jlong a, jlong b) {
548 LDKC2TupleTempl_u64__u64* ret = MALLOC(sizeof(LDKC2TupleTempl_u64__u64), "LDKC2TupleTempl_u64__u64");
553 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
554 LDKCVecTempl_Signature *vec = (LDKCVecTempl_Signature*)ptr;
555 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSignature));
557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1Signature_1_1CVecTempl_1Signature_1new(JNIEnv *_env, jclass _b, jbyteArray a, jobjectArray b) {
558 LDKC2TupleTempl_Signature__CVecTempl_Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_Signature__CVecTempl_Signature), "LDKC2TupleTempl_Signature__CVecTempl_Signature");
560 CHECK((*_env)->GetArrayLength (_env, a) == 64);
561 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
563 LDKCVecTempl_Signature b_constr;
564 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
565 if (b_constr.datalen > 0)
566 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVecTempl_Signature Elements");
568 b_constr.data = NULL;
569 for (size_t i = 0; i < b_constr.datalen; i++) {
570 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
571 LDKSignature arr_conv_8_ref;
572 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
573 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
574 b_constr.data[i] = arr_conv_8_ref;
579 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
580 return ((LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg)->result_ok;
582 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
583 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
584 CHECK(val->result_ok);
585 long res_ref = (long)&(*val->contents.result);
588 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
589 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ *val = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
590 CHECK(!val->result_ok);
591 return *val->contents.err;
593 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
594 return ((LDKCResult_SignatureNoneZ*)arg)->result_ok;
596 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
597 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
598 CHECK(val->result_ok);
599 jbyteArray res_arr = (*_env)->NewByteArray(_env, 64);
600 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 64, (*val->contents.result).compact_form);
603 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SignatureNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
604 LDKCResult_SignatureNoneZ *val = (LDKCResult_SignatureNoneZ*)arg;
605 CHECK(!val->result_ok);
606 return *val->contents.err;
608 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
609 return ((LDKCResult_CVec_SignatureZNoneZ*)arg)->result_ok;
611 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
612 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
613 CHECK(val->result_ok);
614 LDKCVecTempl_Signature res_var = (*val->contents.result);
615 jobjectArray res_arr = (*_env)->NewObjectArray(_env, res_var.datalen, NULL, NULL);
616 for (size_t i = 0; i < res_var.datalen; i++) {
617 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 64);
618 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 64, res_var.data[i].compact_form);
619 (*_env)->SetObjectArrayElement(_env, res_arr, i, arr_conv_8_arr);}
622 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1SignatureZNoneZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
623 LDKCResult_CVec_SignatureZNoneZ *val = (LDKCResult_CVec_SignatureZNoneZ*)arg;
624 CHECK(!val->result_ok);
625 return *val->contents.err;
627 static jclass LDKAPIError_APIMisuseError_class = NULL;
628 static jmethodID LDKAPIError_APIMisuseError_meth = NULL;
629 static jclass LDKAPIError_FeeRateTooHigh_class = NULL;
630 static jmethodID LDKAPIError_FeeRateTooHigh_meth = NULL;
631 static jclass LDKAPIError_RouteError_class = NULL;
632 static jmethodID LDKAPIError_RouteError_meth = NULL;
633 static jclass LDKAPIError_ChannelUnavailable_class = NULL;
634 static jmethodID LDKAPIError_ChannelUnavailable_meth = NULL;
635 static jclass LDKAPIError_MonitorUpdateFailed_class = NULL;
636 static jmethodID LDKAPIError_MonitorUpdateFailed_meth = NULL;
637 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKAPIError_init (JNIEnv * env, jclass _a) {
638 LDKAPIError_APIMisuseError_class =
639 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$APIMisuseError;"));
640 CHECK(LDKAPIError_APIMisuseError_class != NULL);
641 LDKAPIError_APIMisuseError_meth = (*env)->GetMethodID(env, LDKAPIError_APIMisuseError_class, "<init>", "([B)V");
642 CHECK(LDKAPIError_APIMisuseError_meth != NULL);
643 LDKAPIError_FeeRateTooHigh_class =
644 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$FeeRateTooHigh;"));
645 CHECK(LDKAPIError_FeeRateTooHigh_class != NULL);
646 LDKAPIError_FeeRateTooHigh_meth = (*env)->GetMethodID(env, LDKAPIError_FeeRateTooHigh_class, "<init>", "([BI)V");
647 CHECK(LDKAPIError_FeeRateTooHigh_meth != NULL);
648 LDKAPIError_RouteError_class =
649 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$RouteError;"));
650 CHECK(LDKAPIError_RouteError_class != NULL);
651 LDKAPIError_RouteError_meth = (*env)->GetMethodID(env, LDKAPIError_RouteError_class, "<init>", "(Ljava/lang/String;)V");
652 CHECK(LDKAPIError_RouteError_meth != NULL);
653 LDKAPIError_ChannelUnavailable_class =
654 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$ChannelUnavailable;"));
655 CHECK(LDKAPIError_ChannelUnavailable_class != NULL);
656 LDKAPIError_ChannelUnavailable_meth = (*env)->GetMethodID(env, LDKAPIError_ChannelUnavailable_class, "<init>", "([B)V");
657 CHECK(LDKAPIError_ChannelUnavailable_meth != NULL);
658 LDKAPIError_MonitorUpdateFailed_class =
659 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKAPIError$MonitorUpdateFailed;"));
660 CHECK(LDKAPIError_MonitorUpdateFailed_class != NULL);
661 LDKAPIError_MonitorUpdateFailed_meth = (*env)->GetMethodID(env, LDKAPIError_MonitorUpdateFailed_class, "<init>", "()V");
662 CHECK(LDKAPIError_MonitorUpdateFailed_meth != NULL);
664 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAPIError_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
665 LDKAPIError *obj = (LDKAPIError*)ptr;
667 case LDKAPIError_APIMisuseError: {
668 LDKCVec_u8Z err_var = obj->api_misuse_error.err;
669 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
670 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
671 return (*_env)->NewObject(_env, LDKAPIError_APIMisuseError_class, LDKAPIError_APIMisuseError_meth, err_arr);
673 case LDKAPIError_FeeRateTooHigh: {
674 LDKCVec_u8Z err_var = obj->fee_rate_too_high.err;
675 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
676 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
677 return (*_env)->NewObject(_env, LDKAPIError_FeeRateTooHigh_class, LDKAPIError_FeeRateTooHigh_meth, err_arr, obj->fee_rate_too_high.feerate);
679 case LDKAPIError_RouteError: {
680 LDKStr err_str = obj->route_error.err;
681 char* err_buf = MALLOC(err_str.len + 1, "str conv buf");
682 memcpy(err_buf, err_str.chars, err_str.len);
683 err_buf[err_str.len] = 0;
684 jstring err_conv = (*_env)->NewStringUTF(_env, err_str.chars);
686 return (*_env)->NewObject(_env, LDKAPIError_RouteError_class, LDKAPIError_RouteError_meth, err_conv);
688 case LDKAPIError_ChannelUnavailable: {
689 LDKCVec_u8Z err_var = obj->channel_unavailable.err;
690 jbyteArray err_arr = (*_env)->NewByteArray(_env, err_var.datalen);
691 (*_env)->SetByteArrayRegion(_env, err_arr, 0, err_var.datalen, err_var.data);
692 return (*_env)->NewObject(_env, LDKAPIError_ChannelUnavailable_class, LDKAPIError_ChannelUnavailable_meth, err_arr);
694 case LDKAPIError_MonitorUpdateFailed: {
695 return (*_env)->NewObject(_env, LDKAPIError_MonitorUpdateFailed_class, LDKAPIError_MonitorUpdateFailed_meth);
700 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
701 return ((LDKCResult_NoneAPIErrorZ*)arg)->result_ok;
703 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
704 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
705 CHECK(val->result_ok);
706 return *val->contents.result;
708 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NoneAPIErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
709 LDKCResult_NoneAPIErrorZ *val = (LDKCResult_NoneAPIErrorZ*)arg;
710 CHECK(!val->result_ok);
711 long err_ref = (long)&(*val->contents.err);
714 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
715 return ((LDKCResult_NonePaymentSendFailureZ*)arg)->result_ok;
717 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
718 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
719 CHECK(val->result_ok);
720 return *val->contents.result;
722 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePaymentSendFailureZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
723 LDKCResult_NonePaymentSendFailureZ *val = (LDKCResult_NonePaymentSendFailureZ*)arg;
724 CHECK(!val->result_ok);
725 LDKPaymentSendFailure err_var = (*val->contents.err);
726 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
727 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
729 if (err_var.is_owned) {
730 err_ref = (long)err_var.inner | 1;
732 err_ref = (long)&err_var;
736 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) {
737 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate* ret = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
738 LDKChannelAnnouncement a_conv;
739 a_conv.inner = (void*)(a & (~1));
740 a_conv.is_owned = (a & 1) || (a == 0);
741 if (a_conv.inner != NULL)
742 a_conv = ChannelAnnouncement_clone(&a_conv);
744 LDKChannelUpdate b_conv;
745 b_conv.inner = (void*)(b & (~1));
746 b_conv.is_owned = (b & 1) || (b == 0);
747 if (b_conv.inner != NULL)
748 b_conv = ChannelUpdate_clone(&b_conv);
750 LDKChannelUpdate c_conv;
751 c_conv.inner = (void*)(c & (~1));
752 c_conv.is_owned = (c & 1) || (c == 0);
753 if (c_conv.inner != NULL)
754 c_conv = ChannelUpdate_clone(&c_conv);
758 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
759 return ((LDKCResult_NonePeerHandleErrorZ*)arg)->result_ok;
761 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
762 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
763 CHECK(val->result_ok);
764 return *val->contents.result;
766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1NonePeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
767 LDKCResult_NonePeerHandleErrorZ *val = (LDKCResult_NonePeerHandleErrorZ*)arg;
768 CHECK(!val->result_ok);
769 LDKPeerHandleError err_var = (*val->contents.err);
770 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
771 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
773 if (err_var.is_owned) {
774 err_ref = (long)err_var.inner | 1;
776 err_ref = (long)&err_var;
780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKC2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *_env, jclass _b, jlong a, jbyteArray b) {
781 LDKC2TupleTempl_HTLCOutputInCommitment__Signature* ret = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature), "LDKC2TupleTempl_HTLCOutputInCommitment__Signature");
782 LDKHTLCOutputInCommitment a_conv;
783 a_conv.inner = (void*)(a & (~1));
784 a_conv.is_owned = (a & 1) || (a == 0);
785 if (a_conv.inner != NULL)
786 a_conv = HTLCOutputInCommitment_clone(&a_conv);
789 CHECK((*_env)->GetArrayLength (_env, b) == 64);
790 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
794 static jclass LDKSpendableOutputDescriptor_StaticOutput_class = NULL;
795 static jmethodID LDKSpendableOutputDescriptor_StaticOutput_meth = NULL;
796 static jclass LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class = NULL;
797 static jmethodID LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = NULL;
798 static jclass LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class = NULL;
799 static jmethodID LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = NULL;
800 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKSpendableOutputDescriptor_init (JNIEnv * env, jclass _a) {
801 LDKSpendableOutputDescriptor_StaticOutput_class =
802 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutput;"));
803 CHECK(LDKSpendableOutputDescriptor_StaticOutput_class != NULL);
804 LDKSpendableOutputDescriptor_StaticOutput_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutput_class, "<init>", "(JJ)V");
805 CHECK(LDKSpendableOutputDescriptor_StaticOutput_meth != NULL);
806 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class =
807 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$DynamicOutputP2WSH;"));
808 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class != NULL);
809 LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_DynamicOutputP2WSH_class, "<init>", "(J[BSJJ[B)V");
810 CHECK(LDKSpendableOutputDescriptor_DynamicOutputP2WSH_meth != NULL);
811 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class =
812 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSpendableOutputDescriptor$StaticOutputCounterpartyPayment;"));
813 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class != NULL);
814 LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth = (*env)->GetMethodID(env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, "<init>", "(JJJ)V");
815 CHECK(LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth != NULL);
817 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSpendableOutputDescriptor_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
818 LDKSpendableOutputDescriptor *obj = (LDKSpendableOutputDescriptor*)ptr;
820 case LDKSpendableOutputDescriptor_StaticOutput: {
821 LDKOutPoint outpoint_var = obj->static_output.outpoint;
822 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
823 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
825 if (outpoint_var.is_owned) {
826 outpoint_ref = (long)outpoint_var.inner | 1;
828 outpoint_ref = (long)&outpoint_var;
830 long output_ref = (long)&obj->static_output.output;
831 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutput_class, LDKSpendableOutputDescriptor_StaticOutput_meth, outpoint_ref, output_ref);
833 case LDKSpendableOutputDescriptor_DynamicOutputP2WSH: {
834 LDKOutPoint outpoint_var = obj->dynamic_output_p2wsh.outpoint;
835 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
836 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
838 if (outpoint_var.is_owned) {
839 outpoint_ref = (long)outpoint_var.inner | 1;
841 outpoint_ref = (long)&outpoint_var;
843 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
844 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, obj->dynamic_output_p2wsh.per_commitment_point.compressed_form);
845 long output_ref = (long)&obj->dynamic_output_p2wsh.output;
846 long key_derivation_params_ref = (long)&obj->dynamic_output_p2wsh.key_derivation_params;
847 jbyteArray revocation_pubkey_arr = (*_env)->NewByteArray(_env, 33);
848 (*_env)->SetByteArrayRegion(_env, revocation_pubkey_arr, 0, 33, obj->dynamic_output_p2wsh.revocation_pubkey.compressed_form);
849 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);
851 case LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment: {
852 LDKOutPoint outpoint_var = obj->static_output_counterparty_payment.outpoint;
853 CHECK((((long)outpoint_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
854 CHECK((((long)&outpoint_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
856 if (outpoint_var.is_owned) {
857 outpoint_ref = (long)outpoint_var.inner | 1;
859 outpoint_ref = (long)&outpoint_var;
861 long output_ref = (long)&obj->static_output_counterparty_payment.output;
862 long key_derivation_params_ref = (long)&obj->static_output_counterparty_payment.key_derivation_params;
863 return (*_env)->NewObject(_env, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_class, LDKSpendableOutputDescriptor_StaticOutputCounterpartyPayment_meth, outpoint_ref, output_ref, key_derivation_params_ref);
868 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
869 LDKCVecTempl_SpendableOutputDescriptor *vec = (LDKCVecTempl_SpendableOutputDescriptor*)ptr;
870 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKSpendableOutputDescriptor));
872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1SpendableOutputDescriptor_1new(JNIEnv *env, jclass _b, jlongArray elems){
873 LDKCVecTempl_SpendableOutputDescriptor *ret = MALLOC(sizeof(LDKCVecTempl_SpendableOutputDescriptor), "LDKCVecTempl_SpendableOutputDescriptor");
874 ret->datalen = (*env)->GetArrayLength(env, elems);
875 if (ret->datalen == 0) {
878 ret->data = MALLOC(sizeof(LDKSpendableOutputDescriptor) * ret->datalen, "LDKCVecTempl_SpendableOutputDescriptor Data");
879 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
880 for (size_t i = 0; i < ret->datalen; i++) {
881 jlong arr_elem = java_elems[i];
882 LDKSpendableOutputDescriptor arr_elem_conv = *(LDKSpendableOutputDescriptor*)arr_elem;
883 FREE((void*)arr_elem);
884 ret->data[i] = arr_elem_conv;
886 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
890 static jclass LDKEvent_FundingGenerationReady_class = NULL;
891 static jmethodID LDKEvent_FundingGenerationReady_meth = NULL;
892 static jclass LDKEvent_FundingBroadcastSafe_class = NULL;
893 static jmethodID LDKEvent_FundingBroadcastSafe_meth = NULL;
894 static jclass LDKEvent_PaymentReceived_class = NULL;
895 static jmethodID LDKEvent_PaymentReceived_meth = NULL;
896 static jclass LDKEvent_PaymentSent_class = NULL;
897 static jmethodID LDKEvent_PaymentSent_meth = NULL;
898 static jclass LDKEvent_PaymentFailed_class = NULL;
899 static jmethodID LDKEvent_PaymentFailed_meth = NULL;
900 static jclass LDKEvent_PendingHTLCsForwardable_class = NULL;
901 static jmethodID LDKEvent_PendingHTLCsForwardable_meth = NULL;
902 static jclass LDKEvent_SpendableOutputs_class = NULL;
903 static jmethodID LDKEvent_SpendableOutputs_meth = NULL;
904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKEvent_init (JNIEnv * env, jclass _a) {
905 LDKEvent_FundingGenerationReady_class =
906 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingGenerationReady;"));
907 CHECK(LDKEvent_FundingGenerationReady_class != NULL);
908 LDKEvent_FundingGenerationReady_meth = (*env)->GetMethodID(env, LDKEvent_FundingGenerationReady_class, "<init>", "([BJ[BJ)V");
909 CHECK(LDKEvent_FundingGenerationReady_meth != NULL);
910 LDKEvent_FundingBroadcastSafe_class =
911 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$FundingBroadcastSafe;"));
912 CHECK(LDKEvent_FundingBroadcastSafe_class != NULL);
913 LDKEvent_FundingBroadcastSafe_meth = (*env)->GetMethodID(env, LDKEvent_FundingBroadcastSafe_class, "<init>", "(JJ)V");
914 CHECK(LDKEvent_FundingBroadcastSafe_meth != NULL);
915 LDKEvent_PaymentReceived_class =
916 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentReceived;"));
917 CHECK(LDKEvent_PaymentReceived_class != NULL);
918 LDKEvent_PaymentReceived_meth = (*env)->GetMethodID(env, LDKEvent_PaymentReceived_class, "<init>", "([B[BJ)V");
919 CHECK(LDKEvent_PaymentReceived_meth != NULL);
920 LDKEvent_PaymentSent_class =
921 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentSent;"));
922 CHECK(LDKEvent_PaymentSent_class != NULL);
923 LDKEvent_PaymentSent_meth = (*env)->GetMethodID(env, LDKEvent_PaymentSent_class, "<init>", "([B)V");
924 CHECK(LDKEvent_PaymentSent_meth != NULL);
925 LDKEvent_PaymentFailed_class =
926 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PaymentFailed;"));
927 CHECK(LDKEvent_PaymentFailed_class != NULL);
928 LDKEvent_PaymentFailed_meth = (*env)->GetMethodID(env, LDKEvent_PaymentFailed_class, "<init>", "([BZ)V");
929 CHECK(LDKEvent_PaymentFailed_meth != NULL);
930 LDKEvent_PendingHTLCsForwardable_class =
931 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$PendingHTLCsForwardable;"));
932 CHECK(LDKEvent_PendingHTLCsForwardable_class != NULL);
933 LDKEvent_PendingHTLCsForwardable_meth = (*env)->GetMethodID(env, LDKEvent_PendingHTLCsForwardable_class, "<init>", "(J)V");
934 CHECK(LDKEvent_PendingHTLCsForwardable_meth != NULL);
935 LDKEvent_SpendableOutputs_class =
936 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKEvent$SpendableOutputs;"));
937 CHECK(LDKEvent_SpendableOutputs_class != NULL);
938 LDKEvent_SpendableOutputs_meth = (*env)->GetMethodID(env, LDKEvent_SpendableOutputs_class, "<init>", "([J)V");
939 CHECK(LDKEvent_SpendableOutputs_meth != NULL);
941 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
942 LDKEvent *obj = (LDKEvent*)ptr;
944 case LDKEvent_FundingGenerationReady: {
945 jbyteArray temporary_channel_id_arr = (*_env)->NewByteArray(_env, 32);
946 (*_env)->SetByteArrayRegion(_env, temporary_channel_id_arr, 0, 32, obj->funding_generation_ready.temporary_channel_id.data);
947 LDKCVec_u8Z output_script_var = obj->funding_generation_ready.output_script;
948 jbyteArray output_script_arr = (*_env)->NewByteArray(_env, output_script_var.datalen);
949 (*_env)->SetByteArrayRegion(_env, output_script_arr, 0, output_script_var.datalen, output_script_var.data);
950 return (*_env)->NewObject(_env, LDKEvent_FundingGenerationReady_class, LDKEvent_FundingGenerationReady_meth, temporary_channel_id_arr, obj->funding_generation_ready.channel_value_satoshis, output_script_arr, obj->funding_generation_ready.user_channel_id);
952 case LDKEvent_FundingBroadcastSafe: {
953 LDKOutPoint funding_txo_var = obj->funding_broadcast_safe.funding_txo;
954 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
955 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
956 long funding_txo_ref;
957 if (funding_txo_var.is_owned) {
958 funding_txo_ref = (long)funding_txo_var.inner | 1;
960 funding_txo_ref = (long)&funding_txo_var;
962 return (*_env)->NewObject(_env, LDKEvent_FundingBroadcastSafe_class, LDKEvent_FundingBroadcastSafe_meth, funding_txo_ref, obj->funding_broadcast_safe.user_channel_id);
964 case LDKEvent_PaymentReceived: {
965 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
966 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_received.payment_hash.data);
967 jbyteArray payment_secret_arr = (*_env)->NewByteArray(_env, 32);
968 (*_env)->SetByteArrayRegion(_env, payment_secret_arr, 0, 32, obj->payment_received.payment_secret.data);
969 return (*_env)->NewObject(_env, LDKEvent_PaymentReceived_class, LDKEvent_PaymentReceived_meth, payment_hash_arr, payment_secret_arr, obj->payment_received.amt);
971 case LDKEvent_PaymentSent: {
972 jbyteArray payment_preimage_arr = (*_env)->NewByteArray(_env, 32);
973 (*_env)->SetByteArrayRegion(_env, payment_preimage_arr, 0, 32, obj->payment_sent.payment_preimage.data);
974 return (*_env)->NewObject(_env, LDKEvent_PaymentSent_class, LDKEvent_PaymentSent_meth, payment_preimage_arr);
976 case LDKEvent_PaymentFailed: {
977 jbyteArray payment_hash_arr = (*_env)->NewByteArray(_env, 32);
978 (*_env)->SetByteArrayRegion(_env, payment_hash_arr, 0, 32, obj->payment_failed.payment_hash.data);
979 return (*_env)->NewObject(_env, LDKEvent_PaymentFailed_class, LDKEvent_PaymentFailed_meth, payment_hash_arr, obj->payment_failed.rejected_by_dest);
981 case LDKEvent_PendingHTLCsForwardable: {
982 return (*_env)->NewObject(_env, LDKEvent_PendingHTLCsForwardable_class, LDKEvent_PendingHTLCsForwardable_meth, obj->pending_htl_cs_forwardable.time_forwardable);
984 case LDKEvent_SpendableOutputs: {
985 LDKCVec_SpendableOutputDescriptorZ outputs_var = obj->spendable_outputs.outputs;
986 jlongArray outputs_arr = (*_env)->NewLongArray(_env, outputs_var.datalen);
987 jlong *outputs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, outputs_arr, NULL);
988 for (size_t b = 0; b < outputs_var.datalen; b++) {
989 long arr_conv_27_ref = (long)&outputs_var.data[b];
990 outputs_arr_ptr[b] = arr_conv_27_ref;
992 (*_env)->ReleasePrimitiveArrayCritical(_env, outputs_arr, outputs_arr_ptr, 0);
993 return (*_env)->NewObject(_env, LDKEvent_SpendableOutputs_class, LDKEvent_SpendableOutputs_meth, outputs_arr);
998 static jclass LDKErrorAction_DisconnectPeer_class = NULL;
999 static jmethodID LDKErrorAction_DisconnectPeer_meth = NULL;
1000 static jclass LDKErrorAction_IgnoreError_class = NULL;
1001 static jmethodID LDKErrorAction_IgnoreError_meth = NULL;
1002 static jclass LDKErrorAction_SendErrorMessage_class = NULL;
1003 static jmethodID LDKErrorAction_SendErrorMessage_meth = NULL;
1004 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKErrorAction_init (JNIEnv * env, jclass _a) {
1005 LDKErrorAction_DisconnectPeer_class =
1006 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$DisconnectPeer;"));
1007 CHECK(LDKErrorAction_DisconnectPeer_class != NULL);
1008 LDKErrorAction_DisconnectPeer_meth = (*env)->GetMethodID(env, LDKErrorAction_DisconnectPeer_class, "<init>", "(J)V");
1009 CHECK(LDKErrorAction_DisconnectPeer_meth != NULL);
1010 LDKErrorAction_IgnoreError_class =
1011 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$IgnoreError;"));
1012 CHECK(LDKErrorAction_IgnoreError_class != NULL);
1013 LDKErrorAction_IgnoreError_meth = (*env)->GetMethodID(env, LDKErrorAction_IgnoreError_class, "<init>", "()V");
1014 CHECK(LDKErrorAction_IgnoreError_meth != NULL);
1015 LDKErrorAction_SendErrorMessage_class =
1016 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKErrorAction$SendErrorMessage;"));
1017 CHECK(LDKErrorAction_SendErrorMessage_class != NULL);
1018 LDKErrorAction_SendErrorMessage_meth = (*env)->GetMethodID(env, LDKErrorAction_SendErrorMessage_class, "<init>", "(J)V");
1019 CHECK(LDKErrorAction_SendErrorMessage_meth != NULL);
1021 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKErrorAction_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1022 LDKErrorAction *obj = (LDKErrorAction*)ptr;
1024 case LDKErrorAction_DisconnectPeer: {
1025 LDKErrorMessage msg_var = obj->disconnect_peer.msg;
1026 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1027 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1029 if (msg_var.is_owned) {
1030 msg_ref = (long)msg_var.inner | 1;
1032 msg_ref = (long)&msg_var;
1034 return (*_env)->NewObject(_env, LDKErrorAction_DisconnectPeer_class, LDKErrorAction_DisconnectPeer_meth, msg_ref);
1036 case LDKErrorAction_IgnoreError: {
1037 return (*_env)->NewObject(_env, LDKErrorAction_IgnoreError_class, LDKErrorAction_IgnoreError_meth);
1039 case LDKErrorAction_SendErrorMessage: {
1040 LDKErrorMessage msg_var = obj->send_error_message.msg;
1041 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1042 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1044 if (msg_var.is_owned) {
1045 msg_ref = (long)msg_var.inner | 1;
1047 msg_ref = (long)&msg_var;
1049 return (*_env)->NewObject(_env, LDKErrorAction_SendErrorMessage_class, LDKErrorAction_SendErrorMessage_meth, msg_ref);
1054 static jclass LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class = NULL;
1055 static jmethodID LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = NULL;
1056 static jclass LDKHTLCFailChannelUpdate_ChannelClosed_class = NULL;
1057 static jmethodID LDKHTLCFailChannelUpdate_ChannelClosed_meth = NULL;
1058 static jclass LDKHTLCFailChannelUpdate_NodeFailure_class = NULL;
1059 static jmethodID LDKHTLCFailChannelUpdate_NodeFailure_meth = NULL;
1060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKHTLCFailChannelUpdate_init (JNIEnv * env, jclass _a) {
1061 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class =
1062 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelUpdateMessage;"));
1063 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class != NULL);
1064 LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, "<init>", "(J)V");
1065 CHECK(LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth != NULL);
1066 LDKHTLCFailChannelUpdate_ChannelClosed_class =
1067 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$ChannelClosed;"));
1068 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_class != NULL);
1069 LDKHTLCFailChannelUpdate_ChannelClosed_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_ChannelClosed_class, "<init>", "(JZ)V");
1070 CHECK(LDKHTLCFailChannelUpdate_ChannelClosed_meth != NULL);
1071 LDKHTLCFailChannelUpdate_NodeFailure_class =
1072 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKHTLCFailChannelUpdate$NodeFailure;"));
1073 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_class != NULL);
1074 LDKHTLCFailChannelUpdate_NodeFailure_meth = (*env)->GetMethodID(env, LDKHTLCFailChannelUpdate_NodeFailure_class, "<init>", "([BZ)V");
1075 CHECK(LDKHTLCFailChannelUpdate_NodeFailure_meth != NULL);
1077 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKHTLCFailChannelUpdate_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1078 LDKHTLCFailChannelUpdate *obj = (LDKHTLCFailChannelUpdate*)ptr;
1080 case LDKHTLCFailChannelUpdate_ChannelUpdateMessage: {
1081 LDKChannelUpdate msg_var = obj->channel_update_message.msg;
1082 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1083 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1085 if (msg_var.is_owned) {
1086 msg_ref = (long)msg_var.inner | 1;
1088 msg_ref = (long)&msg_var;
1090 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_class, LDKHTLCFailChannelUpdate_ChannelUpdateMessage_meth, msg_ref);
1092 case LDKHTLCFailChannelUpdate_ChannelClosed: {
1093 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_ChannelClosed_class, LDKHTLCFailChannelUpdate_ChannelClosed_meth, obj->channel_closed.short_channel_id, obj->channel_closed.is_permanent);
1095 case LDKHTLCFailChannelUpdate_NodeFailure: {
1096 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1097 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->node_failure.node_id.compressed_form);
1098 return (*_env)->NewObject(_env, LDKHTLCFailChannelUpdate_NodeFailure_class, LDKHTLCFailChannelUpdate_NodeFailure_meth, node_id_arr, obj->node_failure.is_permanent);
1103 static jclass LDKMessageSendEvent_SendAcceptChannel_class = NULL;
1104 static jmethodID LDKMessageSendEvent_SendAcceptChannel_meth = NULL;
1105 static jclass LDKMessageSendEvent_SendOpenChannel_class = NULL;
1106 static jmethodID LDKMessageSendEvent_SendOpenChannel_meth = NULL;
1107 static jclass LDKMessageSendEvent_SendFundingCreated_class = NULL;
1108 static jmethodID LDKMessageSendEvent_SendFundingCreated_meth = NULL;
1109 static jclass LDKMessageSendEvent_SendFundingSigned_class = NULL;
1110 static jmethodID LDKMessageSendEvent_SendFundingSigned_meth = NULL;
1111 static jclass LDKMessageSendEvent_SendFundingLocked_class = NULL;
1112 static jmethodID LDKMessageSendEvent_SendFundingLocked_meth = NULL;
1113 static jclass LDKMessageSendEvent_SendAnnouncementSignatures_class = NULL;
1114 static jmethodID LDKMessageSendEvent_SendAnnouncementSignatures_meth = NULL;
1115 static jclass LDKMessageSendEvent_UpdateHTLCs_class = NULL;
1116 static jmethodID LDKMessageSendEvent_UpdateHTLCs_meth = NULL;
1117 static jclass LDKMessageSendEvent_SendRevokeAndACK_class = NULL;
1118 static jmethodID LDKMessageSendEvent_SendRevokeAndACK_meth = NULL;
1119 static jclass LDKMessageSendEvent_SendClosingSigned_class = NULL;
1120 static jmethodID LDKMessageSendEvent_SendClosingSigned_meth = NULL;
1121 static jclass LDKMessageSendEvent_SendShutdown_class = NULL;
1122 static jmethodID LDKMessageSendEvent_SendShutdown_meth = NULL;
1123 static jclass LDKMessageSendEvent_SendChannelReestablish_class = NULL;
1124 static jmethodID LDKMessageSendEvent_SendChannelReestablish_meth = NULL;
1125 static jclass LDKMessageSendEvent_BroadcastChannelAnnouncement_class = NULL;
1126 static jmethodID LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = NULL;
1127 static jclass LDKMessageSendEvent_BroadcastNodeAnnouncement_class = NULL;
1128 static jmethodID LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = NULL;
1129 static jclass LDKMessageSendEvent_BroadcastChannelUpdate_class = NULL;
1130 static jmethodID LDKMessageSendEvent_BroadcastChannelUpdate_meth = NULL;
1131 static jclass LDKMessageSendEvent_HandleError_class = NULL;
1132 static jmethodID LDKMessageSendEvent_HandleError_meth = NULL;
1133 static jclass LDKMessageSendEvent_PaymentFailureNetworkUpdate_class = NULL;
1134 static jmethodID LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = NULL;
1135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKMessageSendEvent_init (JNIEnv * env, jclass _a) {
1136 LDKMessageSendEvent_SendAcceptChannel_class =
1137 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAcceptChannel;"));
1138 CHECK(LDKMessageSendEvent_SendAcceptChannel_class != NULL);
1139 LDKMessageSendEvent_SendAcceptChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAcceptChannel_class, "<init>", "([BJ)V");
1140 CHECK(LDKMessageSendEvent_SendAcceptChannel_meth != NULL);
1141 LDKMessageSendEvent_SendOpenChannel_class =
1142 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendOpenChannel;"));
1143 CHECK(LDKMessageSendEvent_SendOpenChannel_class != NULL);
1144 LDKMessageSendEvent_SendOpenChannel_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendOpenChannel_class, "<init>", "([BJ)V");
1145 CHECK(LDKMessageSendEvent_SendOpenChannel_meth != NULL);
1146 LDKMessageSendEvent_SendFundingCreated_class =
1147 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingCreated;"));
1148 CHECK(LDKMessageSendEvent_SendFundingCreated_class != NULL);
1149 LDKMessageSendEvent_SendFundingCreated_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingCreated_class, "<init>", "([BJ)V");
1150 CHECK(LDKMessageSendEvent_SendFundingCreated_meth != NULL);
1151 LDKMessageSendEvent_SendFundingSigned_class =
1152 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingSigned;"));
1153 CHECK(LDKMessageSendEvent_SendFundingSigned_class != NULL);
1154 LDKMessageSendEvent_SendFundingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingSigned_class, "<init>", "([BJ)V");
1155 CHECK(LDKMessageSendEvent_SendFundingSigned_meth != NULL);
1156 LDKMessageSendEvent_SendFundingLocked_class =
1157 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendFundingLocked;"));
1158 CHECK(LDKMessageSendEvent_SendFundingLocked_class != NULL);
1159 LDKMessageSendEvent_SendFundingLocked_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendFundingLocked_class, "<init>", "([BJ)V");
1160 CHECK(LDKMessageSendEvent_SendFundingLocked_meth != NULL);
1161 LDKMessageSendEvent_SendAnnouncementSignatures_class =
1162 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendAnnouncementSignatures;"));
1163 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_class != NULL);
1164 LDKMessageSendEvent_SendAnnouncementSignatures_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendAnnouncementSignatures_class, "<init>", "([BJ)V");
1165 CHECK(LDKMessageSendEvent_SendAnnouncementSignatures_meth != NULL);
1166 LDKMessageSendEvent_UpdateHTLCs_class =
1167 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$UpdateHTLCs;"));
1168 CHECK(LDKMessageSendEvent_UpdateHTLCs_class != NULL);
1169 LDKMessageSendEvent_UpdateHTLCs_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_UpdateHTLCs_class, "<init>", "([BJ)V");
1170 CHECK(LDKMessageSendEvent_UpdateHTLCs_meth != NULL);
1171 LDKMessageSendEvent_SendRevokeAndACK_class =
1172 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendRevokeAndACK;"));
1173 CHECK(LDKMessageSendEvent_SendRevokeAndACK_class != NULL);
1174 LDKMessageSendEvent_SendRevokeAndACK_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendRevokeAndACK_class, "<init>", "([BJ)V");
1175 CHECK(LDKMessageSendEvent_SendRevokeAndACK_meth != NULL);
1176 LDKMessageSendEvent_SendClosingSigned_class =
1177 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendClosingSigned;"));
1178 CHECK(LDKMessageSendEvent_SendClosingSigned_class != NULL);
1179 LDKMessageSendEvent_SendClosingSigned_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendClosingSigned_class, "<init>", "([BJ)V");
1180 CHECK(LDKMessageSendEvent_SendClosingSigned_meth != NULL);
1181 LDKMessageSendEvent_SendShutdown_class =
1182 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendShutdown;"));
1183 CHECK(LDKMessageSendEvent_SendShutdown_class != NULL);
1184 LDKMessageSendEvent_SendShutdown_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendShutdown_class, "<init>", "([BJ)V");
1185 CHECK(LDKMessageSendEvent_SendShutdown_meth != NULL);
1186 LDKMessageSendEvent_SendChannelReestablish_class =
1187 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$SendChannelReestablish;"));
1188 CHECK(LDKMessageSendEvent_SendChannelReestablish_class != NULL);
1189 LDKMessageSendEvent_SendChannelReestablish_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_SendChannelReestablish_class, "<init>", "([BJ)V");
1190 CHECK(LDKMessageSendEvent_SendChannelReestablish_meth != NULL);
1191 LDKMessageSendEvent_BroadcastChannelAnnouncement_class =
1192 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelAnnouncement;"));
1193 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_class != NULL);
1194 LDKMessageSendEvent_BroadcastChannelAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, "<init>", "(JJ)V");
1195 CHECK(LDKMessageSendEvent_BroadcastChannelAnnouncement_meth != NULL);
1196 LDKMessageSendEvent_BroadcastNodeAnnouncement_class =
1197 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastNodeAnnouncement;"));
1198 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_class != NULL);
1199 LDKMessageSendEvent_BroadcastNodeAnnouncement_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, "<init>", "(J)V");
1200 CHECK(LDKMessageSendEvent_BroadcastNodeAnnouncement_meth != NULL);
1201 LDKMessageSendEvent_BroadcastChannelUpdate_class =
1202 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$BroadcastChannelUpdate;"));
1203 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_class != NULL);
1204 LDKMessageSendEvent_BroadcastChannelUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_BroadcastChannelUpdate_class, "<init>", "(J)V");
1205 CHECK(LDKMessageSendEvent_BroadcastChannelUpdate_meth != NULL);
1206 LDKMessageSendEvent_HandleError_class =
1207 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$HandleError;"));
1208 CHECK(LDKMessageSendEvent_HandleError_class != NULL);
1209 LDKMessageSendEvent_HandleError_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_HandleError_class, "<init>", "([BJ)V");
1210 CHECK(LDKMessageSendEvent_HandleError_meth != NULL);
1211 LDKMessageSendEvent_PaymentFailureNetworkUpdate_class =
1212 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKMessageSendEvent$PaymentFailureNetworkUpdate;"));
1213 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_class != NULL);
1214 LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth = (*env)->GetMethodID(env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, "<init>", "(J)V");
1215 CHECK(LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth != NULL);
1217 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEvent_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
1218 LDKMessageSendEvent *obj = (LDKMessageSendEvent*)ptr;
1220 case LDKMessageSendEvent_SendAcceptChannel: {
1221 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1222 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_accept_channel.node_id.compressed_form);
1223 LDKAcceptChannel msg_var = obj->send_accept_channel.msg;
1224 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1225 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1227 if (msg_var.is_owned) {
1228 msg_ref = (long)msg_var.inner | 1;
1230 msg_ref = (long)&msg_var;
1232 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAcceptChannel_class, LDKMessageSendEvent_SendAcceptChannel_meth, node_id_arr, msg_ref);
1234 case LDKMessageSendEvent_SendOpenChannel: {
1235 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1236 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_open_channel.node_id.compressed_form);
1237 LDKOpenChannel msg_var = obj->send_open_channel.msg;
1238 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1239 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1241 if (msg_var.is_owned) {
1242 msg_ref = (long)msg_var.inner | 1;
1244 msg_ref = (long)&msg_var;
1246 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendOpenChannel_class, LDKMessageSendEvent_SendOpenChannel_meth, node_id_arr, msg_ref);
1248 case LDKMessageSendEvent_SendFundingCreated: {
1249 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1250 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_created.node_id.compressed_form);
1251 LDKFundingCreated msg_var = obj->send_funding_created.msg;
1252 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1253 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1255 if (msg_var.is_owned) {
1256 msg_ref = (long)msg_var.inner | 1;
1258 msg_ref = (long)&msg_var;
1260 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingCreated_class, LDKMessageSendEvent_SendFundingCreated_meth, node_id_arr, msg_ref);
1262 case LDKMessageSendEvent_SendFundingSigned: {
1263 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1264 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_signed.node_id.compressed_form);
1265 LDKFundingSigned msg_var = obj->send_funding_signed.msg;
1266 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1267 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1269 if (msg_var.is_owned) {
1270 msg_ref = (long)msg_var.inner | 1;
1272 msg_ref = (long)&msg_var;
1274 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingSigned_class, LDKMessageSendEvent_SendFundingSigned_meth, node_id_arr, msg_ref);
1276 case LDKMessageSendEvent_SendFundingLocked: {
1277 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1278 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_funding_locked.node_id.compressed_form);
1279 LDKFundingLocked msg_var = obj->send_funding_locked.msg;
1280 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1281 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1283 if (msg_var.is_owned) {
1284 msg_ref = (long)msg_var.inner | 1;
1286 msg_ref = (long)&msg_var;
1288 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendFundingLocked_class, LDKMessageSendEvent_SendFundingLocked_meth, node_id_arr, msg_ref);
1290 case LDKMessageSendEvent_SendAnnouncementSignatures: {
1291 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1292 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_announcement_signatures.node_id.compressed_form);
1293 LDKAnnouncementSignatures msg_var = obj->send_announcement_signatures.msg;
1294 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1295 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1297 if (msg_var.is_owned) {
1298 msg_ref = (long)msg_var.inner | 1;
1300 msg_ref = (long)&msg_var;
1302 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendAnnouncementSignatures_class, LDKMessageSendEvent_SendAnnouncementSignatures_meth, node_id_arr, msg_ref);
1304 case LDKMessageSendEvent_UpdateHTLCs: {
1305 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1306 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->update_htl_cs.node_id.compressed_form);
1307 LDKCommitmentUpdate updates_var = obj->update_htl_cs.updates;
1308 CHECK((((long)updates_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1309 CHECK((((long)&updates_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1311 if (updates_var.is_owned) {
1312 updates_ref = (long)updates_var.inner | 1;
1314 updates_ref = (long)&updates_var;
1316 return (*_env)->NewObject(_env, LDKMessageSendEvent_UpdateHTLCs_class, LDKMessageSendEvent_UpdateHTLCs_meth, node_id_arr, updates_ref);
1318 case LDKMessageSendEvent_SendRevokeAndACK: {
1319 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1320 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_revoke_and_ack.node_id.compressed_form);
1321 LDKRevokeAndACK msg_var = obj->send_revoke_and_ack.msg;
1322 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1323 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1325 if (msg_var.is_owned) {
1326 msg_ref = (long)msg_var.inner | 1;
1328 msg_ref = (long)&msg_var;
1330 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendRevokeAndACK_class, LDKMessageSendEvent_SendRevokeAndACK_meth, node_id_arr, msg_ref);
1332 case LDKMessageSendEvent_SendClosingSigned: {
1333 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1334 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_closing_signed.node_id.compressed_form);
1335 LDKClosingSigned msg_var = obj->send_closing_signed.msg;
1336 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1337 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1339 if (msg_var.is_owned) {
1340 msg_ref = (long)msg_var.inner | 1;
1342 msg_ref = (long)&msg_var;
1344 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendClosingSigned_class, LDKMessageSendEvent_SendClosingSigned_meth, node_id_arr, msg_ref);
1346 case LDKMessageSendEvent_SendShutdown: {
1347 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1348 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_shutdown.node_id.compressed_form);
1349 LDKShutdown msg_var = obj->send_shutdown.msg;
1350 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1351 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1353 if (msg_var.is_owned) {
1354 msg_ref = (long)msg_var.inner | 1;
1356 msg_ref = (long)&msg_var;
1358 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendShutdown_class, LDKMessageSendEvent_SendShutdown_meth, node_id_arr, msg_ref);
1360 case LDKMessageSendEvent_SendChannelReestablish: {
1361 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1362 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->send_channel_reestablish.node_id.compressed_form);
1363 LDKChannelReestablish msg_var = obj->send_channel_reestablish.msg;
1364 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1365 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1367 if (msg_var.is_owned) {
1368 msg_ref = (long)msg_var.inner | 1;
1370 msg_ref = (long)&msg_var;
1372 return (*_env)->NewObject(_env, LDKMessageSendEvent_SendChannelReestablish_class, LDKMessageSendEvent_SendChannelReestablish_meth, node_id_arr, msg_ref);
1374 case LDKMessageSendEvent_BroadcastChannelAnnouncement: {
1375 LDKChannelAnnouncement msg_var = obj->broadcast_channel_announcement.msg;
1376 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1377 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1379 if (msg_var.is_owned) {
1380 msg_ref = (long)msg_var.inner | 1;
1382 msg_ref = (long)&msg_var;
1384 LDKChannelUpdate update_msg_var = obj->broadcast_channel_announcement.update_msg;
1385 CHECK((((long)update_msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1386 CHECK((((long)&update_msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1387 long update_msg_ref;
1388 if (update_msg_var.is_owned) {
1389 update_msg_ref = (long)update_msg_var.inner | 1;
1391 update_msg_ref = (long)&update_msg_var;
1393 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelAnnouncement_class, LDKMessageSendEvent_BroadcastChannelAnnouncement_meth, msg_ref, update_msg_ref);
1395 case LDKMessageSendEvent_BroadcastNodeAnnouncement: {
1396 LDKNodeAnnouncement msg_var = obj->broadcast_node_announcement.msg;
1397 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1398 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1400 if (msg_var.is_owned) {
1401 msg_ref = (long)msg_var.inner | 1;
1403 msg_ref = (long)&msg_var;
1405 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastNodeAnnouncement_class, LDKMessageSendEvent_BroadcastNodeAnnouncement_meth, msg_ref);
1407 case LDKMessageSendEvent_BroadcastChannelUpdate: {
1408 LDKChannelUpdate msg_var = obj->broadcast_channel_update.msg;
1409 CHECK((((long)msg_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1410 CHECK((((long)&msg_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1412 if (msg_var.is_owned) {
1413 msg_ref = (long)msg_var.inner | 1;
1415 msg_ref = (long)&msg_var;
1417 return (*_env)->NewObject(_env, LDKMessageSendEvent_BroadcastChannelUpdate_class, LDKMessageSendEvent_BroadcastChannelUpdate_meth, msg_ref);
1419 case LDKMessageSendEvent_HandleError: {
1420 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
1421 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, obj->handle_error.node_id.compressed_form);
1422 long action_ref = (long)&obj->handle_error.action;
1423 return (*_env)->NewObject(_env, LDKMessageSendEvent_HandleError_class, LDKMessageSendEvent_HandleError_meth, node_id_arr, action_ref);
1425 case LDKMessageSendEvent_PaymentFailureNetworkUpdate: {
1426 long update_ref = (long)&obj->payment_failure_network_update.update;
1427 return (*_env)->NewObject(_env, LDKMessageSendEvent_PaymentFailureNetworkUpdate_class, LDKMessageSendEvent_PaymentFailureNetworkUpdate_meth, update_ref);
1432 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1433 LDKCVecTempl_MessageSendEvent *vec = (LDKCVecTempl_MessageSendEvent*)ptr;
1434 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKMessageSendEvent));
1436 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MessageSendEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
1437 LDKCVecTempl_MessageSendEvent *ret = MALLOC(sizeof(LDKCVecTempl_MessageSendEvent), "LDKCVecTempl_MessageSendEvent");
1438 ret->datalen = (*env)->GetArrayLength(env, elems);
1439 if (ret->datalen == 0) {
1442 ret->data = MALLOC(sizeof(LDKMessageSendEvent) * ret->datalen, "LDKCVecTempl_MessageSendEvent Data");
1443 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1444 for (size_t i = 0; i < ret->datalen; i++) {
1445 jlong arr_elem = java_elems[i];
1446 LDKMessageSendEvent arr_elem_conv = *(LDKMessageSendEvent*)arr_elem;
1447 FREE((void*)arr_elem);
1448 ret->data[i] = arr_elem_conv;
1450 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1454 typedef struct LDKMessageSendEventsProvider_JCalls {
1455 atomic_size_t refcnt;
1458 jmethodID get_and_clear_pending_msg_events_meth;
1459 } LDKMessageSendEventsProvider_JCalls;
1460 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
1461 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1463 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1464 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1466 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_msg_events_meth);
1467 LDKCVec_MessageSendEventZ ret_constr;
1468 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1469 if (ret_constr.datalen > 0)
1470 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
1472 ret_constr.data = NULL;
1473 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1474 for (size_t s = 0; s < ret_constr.datalen; s++) {
1475 long arr_conv_18 = ret_vals[s];
1476 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
1477 FREE((void*)arr_conv_18);
1478 ret_constr.data[s] = arr_conv_18_conv;
1480 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1483 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
1484 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1485 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1487 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1488 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1492 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
1493 LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
1494 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1495 return (void*) this_arg;
1497 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1498 jclass c = (*env)->GetObjectClass(env, o);
1500 LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
1501 atomic_init(&calls->refcnt, 1);
1502 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1503 calls->o = (*env)->NewWeakGlobalRef(env, o);
1504 calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()[J");
1505 CHECK(calls->get_and_clear_pending_msg_events_meth != NULL);
1507 LDKMessageSendEventsProvider ret = {
1508 .this_arg = (void*) calls,
1509 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
1510 .free = LDKMessageSendEventsProvider_JCalls_free,
1514 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1515 LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
1516 *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
1517 return (long)res_ptr;
1519 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1520 jobject ret = (*env)->NewLocalRef(env, ((LDKMessageSendEventsProvider_JCalls*)val)->o);
1524 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1get_1and_1clear_1pending_1msg_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1525 LDKMessageSendEventsProvider* this_arg_conv = (LDKMessageSendEventsProvider*)this_arg;
1526 LDKCVec_MessageSendEventZ ret_var = (this_arg_conv->get_and_clear_pending_msg_events)(this_arg_conv->this_arg);
1527 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1528 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1529 for (size_t s = 0; s < ret_var.datalen; s++) {
1530 long arr_conv_18_ref = (long)&ret_var.data[s];
1531 ret_arr_ptr[s] = arr_conv_18_ref;
1533 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1537 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1538 LDKCVecTempl_Event *vec = (LDKCVecTempl_Event*)ptr;
1539 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKEvent));
1541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Event_1new(JNIEnv *env, jclass _b, jlongArray elems){
1542 LDKCVecTempl_Event *ret = MALLOC(sizeof(LDKCVecTempl_Event), "LDKCVecTempl_Event");
1543 ret->datalen = (*env)->GetArrayLength(env, elems);
1544 if (ret->datalen == 0) {
1547 ret->data = MALLOC(sizeof(LDKEvent) * ret->datalen, "LDKCVecTempl_Event Data");
1548 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1549 for (size_t i = 0; i < ret->datalen; i++) {
1550 jlong arr_elem = java_elems[i];
1551 LDKEvent arr_elem_conv = *(LDKEvent*)arr_elem;
1552 FREE((void*)arr_elem);
1553 ret->data[i] = arr_elem_conv;
1555 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1559 typedef struct LDKEventsProvider_JCalls {
1560 atomic_size_t refcnt;
1563 jmethodID get_and_clear_pending_events_meth;
1564 } LDKEventsProvider_JCalls;
1565 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
1566 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1568 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1569 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1571 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_and_clear_pending_events_meth);
1572 LDKCVec_EventZ ret_constr;
1573 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
1574 if (ret_constr.datalen > 0)
1575 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
1577 ret_constr.data = NULL;
1578 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
1579 for (size_t h = 0; h < ret_constr.datalen; h++) {
1580 long arr_conv_7 = ret_vals[h];
1581 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
1582 FREE((void*)arr_conv_7);
1583 ret_constr.data[h] = arr_conv_7_conv;
1585 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
1588 static void LDKEventsProvider_JCalls_free(void* this_arg) {
1589 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1590 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1592 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1593 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1597 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
1598 LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
1599 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1600 return (void*) this_arg;
1602 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
1603 jclass c = (*env)->GetObjectClass(env, o);
1605 LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
1606 atomic_init(&calls->refcnt, 1);
1607 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1608 calls->o = (*env)->NewWeakGlobalRef(env, o);
1609 calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()[J");
1610 CHECK(calls->get_and_clear_pending_events_meth != NULL);
1612 LDKEventsProvider ret = {
1613 .this_arg = (void*) calls,
1614 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
1615 .free = LDKEventsProvider_JCalls_free,
1619 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
1620 LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
1621 *res_ptr = LDKEventsProvider_init(env, _a, o);
1622 return (long)res_ptr;
1624 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1625 jobject ret = (*env)->NewLocalRef(env, ((LDKEventsProvider_JCalls*)val)->o);
1629 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_EventsProvider_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
1630 LDKEventsProvider* this_arg_conv = (LDKEventsProvider*)this_arg;
1631 LDKCVec_EventZ ret_var = (this_arg_conv->get_and_clear_pending_events)(this_arg_conv->this_arg);
1632 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
1633 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
1634 for (size_t h = 0; h < ret_var.datalen; h++) {
1635 long arr_conv_7_ref = (long)&ret_var.data[h];
1636 ret_arr_ptr[h] = arr_conv_7_ref;
1638 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
1642 typedef struct LDKLogger_JCalls {
1643 atomic_size_t refcnt;
1648 void log_jcall(const void* this_arg, const char *record) {
1649 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1651 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1652 jstring record_conv = (*_env)->NewStringUTF(_env, record);
1653 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1655 return (*_env)->CallVoidMethod(_env, obj, j_calls->log_meth, record_conv);
1657 static void LDKLogger_JCalls_free(void* this_arg) {
1658 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1659 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1661 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1662 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1666 static void* LDKLogger_JCalls_clone(const void* this_arg) {
1667 LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
1668 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1669 return (void*) this_arg;
1671 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
1672 jclass c = (*env)->GetObjectClass(env, o);
1674 LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
1675 atomic_init(&calls->refcnt, 1);
1676 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1677 calls->o = (*env)->NewWeakGlobalRef(env, o);
1678 calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
1679 CHECK(calls->log_meth != NULL);
1682 .this_arg = (void*) calls,
1684 .free = LDKLogger_JCalls_free,
1688 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
1689 LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
1690 *res_ptr = LDKLogger_init(env, _a, o);
1691 return (long)res_ptr;
1693 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKLogger_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1694 jobject ret = (*env)->NewLocalRef(env, ((LDKLogger_JCalls*)val)->o);
1698 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
1699 return ((LDKCResult_TxOutAccessErrorZ*)arg)->result_ok;
1701 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
1702 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1703 CHECK(val->result_ok);
1704 long res_ref = (long)&(*val->contents.result);
1707 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxOutAccessErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
1708 LDKCResult_TxOutAccessErrorZ *val = (LDKCResult_TxOutAccessErrorZ*)arg;
1709 CHECK(!val->result_ok);
1710 jclass err_conv = LDKAccessError_to_java(_env, (*val->contents.err));
1713 typedef struct LDKAccess_JCalls {
1714 atomic_size_t refcnt;
1717 jmethodID get_utxo_meth;
1719 LDKCResult_TxOutAccessErrorZ get_utxo_jcall(const void* this_arg, const uint8_t (*genesis_hash)[32], uint64_t short_channel_id) {
1720 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1722 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1723 jbyteArray genesis_hash_arr = (*_env)->NewByteArray(_env, 32);
1724 (*_env)->SetByteArrayRegion(_env, genesis_hash_arr, 0, 32, *genesis_hash);
1725 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1727 LDKCResult_TxOutAccessErrorZ* ret = (LDKCResult_TxOutAccessErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->get_utxo_meth, genesis_hash_arr, short_channel_id);
1728 LDKCResult_TxOutAccessErrorZ res = *ret;
1732 static void LDKAccess_JCalls_free(void* this_arg) {
1733 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1734 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1736 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1737 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1741 static void* LDKAccess_JCalls_clone(const void* this_arg) {
1742 LDKAccess_JCalls *j_calls = (LDKAccess_JCalls*) this_arg;
1743 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1744 return (void*) this_arg;
1746 static inline LDKAccess LDKAccess_init (JNIEnv * env, jclass _a, jobject o) {
1747 jclass c = (*env)->GetObjectClass(env, o);
1749 LDKAccess_JCalls *calls = MALLOC(sizeof(LDKAccess_JCalls), "LDKAccess_JCalls");
1750 atomic_init(&calls->refcnt, 1);
1751 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1752 calls->o = (*env)->NewWeakGlobalRef(env, o);
1753 calls->get_utxo_meth = (*env)->GetMethodID(env, c, "get_utxo", "([BJ)J");
1754 CHECK(calls->get_utxo_meth != NULL);
1757 .this_arg = (void*) calls,
1758 .get_utxo = get_utxo_jcall,
1759 .free = LDKAccess_JCalls_free,
1763 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKAccess_1new (JNIEnv * env, jclass _a, jobject o) {
1764 LDKAccess *res_ptr = MALLOC(sizeof(LDKAccess), "LDKAccess");
1765 *res_ptr = LDKAccess_init(env, _a, o);
1766 return (long)res_ptr;
1768 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKAccess_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
1769 jobject ret = (*env)->NewLocalRef(env, ((LDKAccess_JCalls*)val)->o);
1773 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) {
1774 LDKAccess* this_arg_conv = (LDKAccess*)this_arg;
1775 unsigned char genesis_hash_arr[32];
1776 CHECK((*_env)->GetArrayLength (_env, genesis_hash) == 32);
1777 (*_env)->GetByteArrayRegion (_env, genesis_hash, 0, 32, genesis_hash_arr);
1778 unsigned char (*genesis_hash_ref)[32] = &genesis_hash_arr;
1779 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
1780 *ret = (this_arg_conv->get_utxo)(this_arg_conv->this_arg, genesis_hash_ref, short_channel_id);
1784 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
1785 LDKCVecTempl_HTLCOutputInCommitment *vec = (LDKCVecTempl_HTLCOutputInCommitment*)ptr;
1786 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
1787 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
1788 for (size_t i = 0; i < vec->datalen; i++) {
1789 CHECK((((long)vec->data[i].inner) & 1) == 0);
1790 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
1792 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
1795 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1HTLCOutputInCommitment_1new(JNIEnv *env, jclass _b, jlongArray elems){
1796 LDKCVecTempl_HTLCOutputInCommitment *ret = MALLOC(sizeof(LDKCVecTempl_HTLCOutputInCommitment), "LDKCVecTempl_HTLCOutputInCommitment");
1797 ret->datalen = (*env)->GetArrayLength(env, elems);
1798 if (ret->datalen == 0) {
1801 ret->data = MALLOC(sizeof(LDKHTLCOutputInCommitment) * ret->datalen, "LDKCVecTempl_HTLCOutputInCommitment Data");
1802 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
1803 for (size_t i = 0; i < ret->datalen; i++) {
1804 jlong arr_elem = java_elems[i];
1805 LDKHTLCOutputInCommitment arr_elem_conv;
1806 arr_elem_conv.inner = (void*)(arr_elem & (~1));
1807 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
1808 if (arr_elem_conv.inner != NULL)
1809 arr_elem_conv = HTLCOutputInCommitment_clone(&arr_elem_conv);
1810 ret->data[i] = arr_elem_conv;
1812 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
1816 typedef struct LDKChannelKeys_JCalls {
1817 atomic_size_t refcnt;
1820 jmethodID get_per_commitment_point_meth;
1821 jmethodID release_commitment_secret_meth;
1822 jmethodID key_derivation_params_meth;
1823 jmethodID sign_counterparty_commitment_meth;
1824 jmethodID sign_holder_commitment_meth;
1825 jmethodID sign_holder_commitment_htlc_transactions_meth;
1826 jmethodID sign_justice_transaction_meth;
1827 jmethodID sign_counterparty_htlc_transaction_meth;
1828 jmethodID sign_closing_transaction_meth;
1829 jmethodID sign_channel_announcement_meth;
1830 jmethodID on_accept_meth;
1831 } LDKChannelKeys_JCalls;
1832 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
1833 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1835 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1836 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1838 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_per_commitment_point_meth, idx);
1839 LDKPublicKey ret_ref;
1840 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
1841 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
1844 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
1845 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1847 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1848 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1850 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_commitment_secret_meth, idx);
1851 LDKThirtyTwoBytes ret_ref;
1852 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
1853 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
1856 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
1857 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1859 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1860 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1862 LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*_env)->CallLongMethod(_env, obj, j_calls->key_derivation_params_meth);
1863 LDKC2Tuple_u64u64Z res = *ret;
1867 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) {
1868 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1870 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1871 long commitment_tx_ref = (long)&commitment_tx;
1872 LDKCVec_HTLCOutputInCommitmentZ htlcs_var = htlcs;
1873 jlongArray htlcs_arr = (*_env)->NewLongArray(_env, htlcs_var.datalen);
1874 jlong *htlcs_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, htlcs_arr, NULL);
1875 for (size_t y = 0; y < htlcs_var.datalen; y++) {
1876 LDKHTLCOutputInCommitment arr_conv_24_var = htlcs_var.data[y];
1877 CHECK((((long)arr_conv_24_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
1878 CHECK((((long)&arr_conv_24_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
1879 long arr_conv_24_ref;
1880 if (arr_conv_24_var.is_owned) {
1881 arr_conv_24_ref = (long)arr_conv_24_var.inner | 1;
1883 arr_conv_24_ref = (long)&arr_conv_24_var;
1885 htlcs_arr_ptr[y] = arr_conv_24_ref;
1887 (*_env)->ReleasePrimitiveArrayCritical(_env, htlcs_arr, htlcs_arr_ptr, 0);
1888 FREE(htlcs_var.data);
1889 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1891 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_arr);
1892 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
1896 LDKCResult_SignatureNoneZ sign_holder_commitment_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1897 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1899 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1900 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1902 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_meth, holder_commitment_tx);
1903 LDKCResult_SignatureNoneZ res = *ret;
1907 LDKCResult_CVec_SignatureZNoneZ sign_holder_commitment_htlc_transactions_jcall(const void* this_arg, const LDKHolderCommitmentTransaction *holder_commitment_tx) {
1908 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1910 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1911 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1913 LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_holder_commitment_htlc_transactions_meth, holder_commitment_tx);
1914 LDKCResult_CVec_SignatureZNoneZ res = *ret;
1918 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) {
1919 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1921 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1922 long justice_tx_ref = (long)&justice_tx;
1923 jbyteArray per_commitment_key_arr = (*_env)->NewByteArray(_env, 32);
1924 (*_env)->SetByteArrayRegion(_env, per_commitment_key_arr, 0, 32, *per_commitment_key);
1925 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1927 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);
1928 LDKCResult_SignatureNoneZ res = *ret;
1932 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) {
1933 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1935 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1936 long htlc_tx_ref = (long)&htlc_tx;
1937 jbyteArray per_commitment_point_arr = (*_env)->NewByteArray(_env, 33);
1938 (*_env)->SetByteArrayRegion(_env, per_commitment_point_arr, 0, 33, per_commitment_point.compressed_form);
1939 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1941 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);
1942 LDKCResult_SignatureNoneZ res = *ret;
1946 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
1947 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1949 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1950 long closing_tx_ref = (long)&closing_tx;
1951 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1953 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_closing_transaction_meth, closing_tx_ref);
1954 LDKCResult_SignatureNoneZ res = *ret;
1958 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
1959 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1961 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1962 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1964 LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*_env)->CallLongMethod(_env, obj, j_calls->sign_channel_announcement_meth, msg);
1965 LDKCResult_SignatureNoneZ res = *ret;
1969 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t counterparty_selected_contest_delay, uint16_t holder_selected_contest_delay) {
1970 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1972 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
1973 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
1975 return (*_env)->CallVoidMethod(_env, obj, j_calls->on_accept_meth, channel_points, counterparty_selected_contest_delay, holder_selected_contest_delay);
1977 static void LDKChannelKeys_JCalls_free(void* this_arg) {
1978 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1979 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1981 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
1982 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
1986 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
1987 LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
1988 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1989 return (void*) this_arg;
1991 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
1992 jclass c = (*env)->GetObjectClass(env, o);
1994 LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
1995 atomic_init(&calls->refcnt, 1);
1996 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
1997 calls->o = (*env)->NewWeakGlobalRef(env, o);
1998 calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)[B");
1999 CHECK(calls->get_per_commitment_point_meth != NULL);
2000 calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)[B");
2001 CHECK(calls->release_commitment_secret_meth != NULL);
2002 calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
2003 CHECK(calls->key_derivation_params_meth != NULL);
2004 calls->sign_counterparty_commitment_meth = (*env)->GetMethodID(env, c, "sign_counterparty_commitment", "(IJJ[J)J");
2005 CHECK(calls->sign_counterparty_commitment_meth != NULL);
2006 calls->sign_holder_commitment_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment", "(J)J");
2007 CHECK(calls->sign_holder_commitment_meth != NULL);
2008 calls->sign_holder_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_holder_commitment_htlc_transactions", "(J)J");
2009 CHECK(calls->sign_holder_commitment_htlc_transactions_meth != NULL);
2010 calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
2011 CHECK(calls->sign_justice_transaction_meth != NULL);
2012 calls->sign_counterparty_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_counterparty_htlc_transaction", "(JJJ[BJ)J");
2013 CHECK(calls->sign_counterparty_htlc_transaction_meth != NULL);
2014 calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
2015 CHECK(calls->sign_closing_transaction_meth != NULL);
2016 calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
2017 CHECK(calls->sign_channel_announcement_meth != NULL);
2018 calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
2019 CHECK(calls->on_accept_meth != NULL);
2021 LDKChannelKeys ret = {
2022 .this_arg = (void*) calls,
2023 .get_per_commitment_point = get_per_commitment_point_jcall,
2024 .release_commitment_secret = release_commitment_secret_jcall,
2025 .key_derivation_params = key_derivation_params_jcall,
2026 .sign_counterparty_commitment = sign_counterparty_commitment_jcall,
2027 .sign_holder_commitment = sign_holder_commitment_jcall,
2028 .sign_holder_commitment_htlc_transactions = sign_holder_commitment_htlc_transactions_jcall,
2029 .sign_justice_transaction = sign_justice_transaction_jcall,
2030 .sign_counterparty_htlc_transaction = sign_counterparty_htlc_transaction_jcall,
2031 .sign_closing_transaction = sign_closing_transaction_jcall,
2032 .sign_channel_announcement = sign_channel_announcement_jcall,
2033 .on_accept = on_accept_jcall,
2034 .clone = LDKChannelKeys_JCalls_clone,
2035 .free = LDKChannelKeys_JCalls_free,
2039 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
2040 LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2041 *res_ptr = LDKChannelKeys_init(env, _a, o);
2042 return (long)res_ptr;
2044 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2045 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelKeys_JCalls*)val)->o);
2049 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2050 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2051 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2052 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_per_commitment_point)(this_arg_conv->this_arg, idx).compressed_form);
2056 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1release_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_arg, jlong idx) {
2057 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2058 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2059 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->release_commitment_secret)(this_arg_conv->this_arg, idx).data);
2063 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1key_1derivation_1params(JNIEnv * _env, jclass _b, jlong this_arg) {
2064 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2065 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
2066 *ret = (this_arg_conv->key_derivation_params)(this_arg_conv->this_arg);
2070 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, jlongArray htlcs) {
2071 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2072 LDKTransaction commitment_tx_conv = *(LDKTransaction*)commitment_tx;
2073 FREE((void*)commitment_tx);
2074 LDKPreCalculatedTxCreationKeys keys_conv;
2075 keys_conv.inner = (void*)(keys & (~1));
2076 keys_conv.is_owned = (keys & 1) || (keys == 0);
2077 LDKCVec_HTLCOutputInCommitmentZ htlcs_constr;
2078 htlcs_constr.datalen = (*_env)->GetArrayLength (_env, htlcs);
2079 if (htlcs_constr.datalen > 0)
2080 htlcs_constr.data = MALLOC(htlcs_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
2082 htlcs_constr.data = NULL;
2083 long* htlcs_vals = (*_env)->GetLongArrayElements (_env, htlcs, NULL);
2084 for (size_t y = 0; y < htlcs_constr.datalen; y++) {
2085 long arr_conv_24 = htlcs_vals[y];
2086 LDKHTLCOutputInCommitment arr_conv_24_conv;
2087 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
2088 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
2089 if (arr_conv_24_conv.inner != NULL)
2090 arr_conv_24_conv = HTLCOutputInCommitment_clone(&arr_conv_24_conv);
2091 htlcs_constr.data[y] = arr_conv_24_conv;
2093 (*_env)->ReleaseLongArrayElements (_env, htlcs, htlcs_vals, 0);
2094 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
2095 *ret = (this_arg_conv->sign_counterparty_commitment)(this_arg_conv->this_arg, feerate_per_kw, commitment_tx_conv, &keys_conv, htlcs_constr);
2099 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1holder_1commitment(JNIEnv * _env, jclass _b, jlong this_arg, jlong holder_commitment_tx) {
2100 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2101 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2102 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2103 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2104 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2105 *ret = (this_arg_conv->sign_holder_commitment)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2109 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) {
2110 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2111 LDKHolderCommitmentTransaction holder_commitment_tx_conv;
2112 holder_commitment_tx_conv.inner = (void*)(holder_commitment_tx & (~1));
2113 holder_commitment_tx_conv.is_owned = (holder_commitment_tx & 1) || (holder_commitment_tx == 0);
2114 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
2115 *ret = (this_arg_conv->sign_holder_commitment_htlc_transactions)(this_arg_conv->this_arg, &holder_commitment_tx_conv);
2119 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) {
2120 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2121 LDKTransaction justice_tx_conv = *(LDKTransaction*)justice_tx;
2122 FREE((void*)justice_tx);
2123 unsigned char per_commitment_key_arr[32];
2124 CHECK((*_env)->GetArrayLength (_env, per_commitment_key) == 32);
2125 (*_env)->GetByteArrayRegion (_env, per_commitment_key, 0, 32, per_commitment_key_arr);
2126 unsigned char (*per_commitment_key_ref)[32] = &per_commitment_key_arr;
2127 LDKHTLCOutputInCommitment htlc_conv;
2128 htlc_conv.inner = (void*)(htlc & (~1));
2129 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2130 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2131 *ret = (this_arg_conv->sign_justice_transaction)(this_arg_conv->this_arg, justice_tx_conv, input, amount, per_commitment_key_ref, &htlc_conv);
2135 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) {
2136 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2137 LDKTransaction htlc_tx_conv = *(LDKTransaction*)htlc_tx;
2138 FREE((void*)htlc_tx);
2139 LDKPublicKey per_commitment_point_ref;
2140 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
2141 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
2142 LDKHTLCOutputInCommitment htlc_conv;
2143 htlc_conv.inner = (void*)(htlc & (~1));
2144 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
2145 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2146 *ret = (this_arg_conv->sign_counterparty_htlc_transaction)(this_arg_conv->this_arg, htlc_tx_conv, input, amount, per_commitment_point_ref, &htlc_conv);
2150 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1closing_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong closing_tx) {
2151 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2152 LDKTransaction closing_tx_conv = *(LDKTransaction*)closing_tx;
2153 FREE((void*)closing_tx);
2154 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2155 *ret = (this_arg_conv->sign_closing_transaction)(this_arg_conv->this_arg, closing_tx_conv);
2159 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1sign_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
2160 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2161 LDKUnsignedChannelAnnouncement msg_conv;
2162 msg_conv.inner = (void*)(msg & (~1));
2163 msg_conv.is_owned = (msg & 1) || (msg == 0);
2164 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
2165 *ret = (this_arg_conv->sign_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
2169 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) {
2170 LDKChannelKeys* this_arg_conv = (LDKChannelKeys*)this_arg;
2171 LDKChannelPublicKeys channel_points_conv;
2172 channel_points_conv.inner = (void*)(channel_points & (~1));
2173 channel_points_conv.is_owned = (channel_points & 1) || (channel_points == 0);
2174 (this_arg_conv->on_accept)(this_arg_conv->this_arg, &channel_points_conv, counterparty_selected_contest_delay, holder_selected_contest_delay);
2177 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2178 LDKCVecTempl_MonitorEvent *vec = (LDKCVecTempl_MonitorEvent*)ptr;
2179 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2180 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2181 for (size_t i = 0; i < vec->datalen; i++) {
2182 CHECK((((long)vec->data[i].inner) & 1) == 0);
2183 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2185 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2188 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1MonitorEvent_1new(JNIEnv *env, jclass _b, jlongArray elems){
2189 LDKCVecTempl_MonitorEvent *ret = MALLOC(sizeof(LDKCVecTempl_MonitorEvent), "LDKCVecTempl_MonitorEvent");
2190 ret->datalen = (*env)->GetArrayLength(env, elems);
2191 if (ret->datalen == 0) {
2194 ret->data = MALLOC(sizeof(LDKMonitorEvent) * ret->datalen, "LDKCVecTempl_MonitorEvent Data");
2195 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2196 for (size_t i = 0; i < ret->datalen; i++) {
2197 jlong arr_elem = java_elems[i];
2198 LDKMonitorEvent arr_elem_conv;
2199 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2200 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2201 // Warning: we may need a move here but can't clone!
2202 ret->data[i] = arr_elem_conv;
2204 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2208 typedef struct LDKWatch_JCalls {
2209 atomic_size_t refcnt;
2212 jmethodID watch_channel_meth;
2213 jmethodID update_channel_meth;
2214 jmethodID release_pending_monitor_events_meth;
2216 LDKCResult_NoneChannelMonitorUpdateErrZ watch_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
2217 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2219 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2220 LDKOutPoint funding_txo_var = funding_txo;
2221 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2222 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2223 long funding_txo_ref;
2224 if (funding_txo_var.is_owned) {
2225 funding_txo_ref = (long)funding_txo_var.inner | 1;
2227 funding_txo_ref = (long)&funding_txo_var;
2229 LDKChannelMonitor monitor_var = monitor;
2230 CHECK((((long)monitor_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2231 CHECK((((long)&monitor_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2233 if (monitor_var.is_owned) {
2234 monitor_ref = (long)monitor_var.inner | 1;
2236 monitor_ref = (long)&monitor_var;
2238 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2240 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->watch_channel_meth, funding_txo_ref, monitor_ref);
2241 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2245 LDKCResult_NoneChannelMonitorUpdateErrZ update_channel_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate update) {
2246 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2248 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2249 LDKOutPoint funding_txo_var = funding_txo;
2250 CHECK((((long)funding_txo_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2251 CHECK((((long)&funding_txo_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2252 long funding_txo_ref;
2253 if (funding_txo_var.is_owned) {
2254 funding_txo_ref = (long)funding_txo_var.inner | 1;
2256 funding_txo_ref = (long)&funding_txo_var;
2258 LDKChannelMonitorUpdate update_var = update;
2259 CHECK((((long)update_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2260 CHECK((((long)&update_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2262 if (update_var.is_owned) {
2263 update_ref = (long)update_var.inner | 1;
2265 update_ref = (long)&update_var;
2267 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2269 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*_env)->CallLongMethod(_env, obj, j_calls->update_channel_meth, funding_txo_ref, update_ref);
2270 LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
2274 LDKCVec_MonitorEventZ release_pending_monitor_events_jcall(const void* this_arg) {
2275 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2277 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2278 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2280 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->release_pending_monitor_events_meth);
2281 LDKCVec_MonitorEventZ ret_constr;
2282 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
2283 if (ret_constr.datalen > 0)
2284 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
2286 ret_constr.data = NULL;
2287 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
2288 for (size_t o = 0; o < ret_constr.datalen; o++) {
2289 long arr_conv_14 = ret_vals[o];
2290 LDKMonitorEvent arr_conv_14_conv;
2291 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
2292 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
2293 // Warning: we may need a move here but can't clone!
2294 ret_constr.data[o] = arr_conv_14_conv;
2296 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
2299 static void LDKWatch_JCalls_free(void* this_arg) {
2300 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2301 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2303 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2304 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2308 static void* LDKWatch_JCalls_clone(const void* this_arg) {
2309 LDKWatch_JCalls *j_calls = (LDKWatch_JCalls*) this_arg;
2310 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2311 return (void*) this_arg;
2313 static inline LDKWatch LDKWatch_init (JNIEnv * env, jclass _a, jobject o) {
2314 jclass c = (*env)->GetObjectClass(env, o);
2316 LDKWatch_JCalls *calls = MALLOC(sizeof(LDKWatch_JCalls), "LDKWatch_JCalls");
2317 atomic_init(&calls->refcnt, 1);
2318 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2319 calls->o = (*env)->NewWeakGlobalRef(env, o);
2320 calls->watch_channel_meth = (*env)->GetMethodID(env, c, "watch_channel", "(JJ)J");
2321 CHECK(calls->watch_channel_meth != NULL);
2322 calls->update_channel_meth = (*env)->GetMethodID(env, c, "update_channel", "(JJ)J");
2323 CHECK(calls->update_channel_meth != NULL);
2324 calls->release_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "release_pending_monitor_events", "()[J");
2325 CHECK(calls->release_pending_monitor_events_meth != NULL);
2328 .this_arg = (void*) calls,
2329 .watch_channel = watch_channel_jcall,
2330 .update_channel = update_channel_jcall,
2331 .release_pending_monitor_events = release_pending_monitor_events_jcall,
2332 .free = LDKWatch_JCalls_free,
2336 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKWatch_1new (JNIEnv * env, jclass _a, jobject o) {
2337 LDKWatch *res_ptr = MALLOC(sizeof(LDKWatch), "LDKWatch");
2338 *res_ptr = LDKWatch_init(env, _a, o);
2339 return (long)res_ptr;
2341 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKWatch_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2342 jobject ret = (*env)->NewLocalRef(env, ((LDKWatch_JCalls*)val)->o);
2346 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1watch_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong monitor) {
2347 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2348 LDKOutPoint funding_txo_conv;
2349 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2350 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2351 if (funding_txo_conv.inner != NULL)
2352 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2353 LDKChannelMonitor monitor_conv;
2354 monitor_conv.inner = (void*)(monitor & (~1));
2355 monitor_conv.is_owned = (monitor & 1) || (monitor == 0);
2356 // Warning: we may need a move here but can't clone!
2357 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2358 *ret = (this_arg_conv->watch_channel)(this_arg_conv->this_arg, funding_txo_conv, monitor_conv);
2362 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Watch_1update_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong update) {
2363 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2364 LDKOutPoint funding_txo_conv;
2365 funding_txo_conv.inner = (void*)(funding_txo & (~1));
2366 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
2367 if (funding_txo_conv.inner != NULL)
2368 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
2369 LDKChannelMonitorUpdate update_conv;
2370 update_conv.inner = (void*)(update & (~1));
2371 update_conv.is_owned = (update & 1) || (update == 0);
2372 if (update_conv.inner != NULL)
2373 update_conv = ChannelMonitorUpdate_clone(&update_conv);
2374 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
2375 *ret = (this_arg_conv->update_channel)(this_arg_conv->this_arg, funding_txo_conv, update_conv);
2379 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_Watch_1release_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
2380 LDKWatch* this_arg_conv = (LDKWatch*)this_arg;
2381 LDKCVec_MonitorEventZ ret_var = (this_arg_conv->release_pending_monitor_events)(this_arg_conv->this_arg);
2382 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
2383 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
2384 for (size_t o = 0; o < ret_var.datalen; o++) {
2385 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
2386 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2387 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2388 long arr_conv_14_ref;
2389 if (arr_conv_14_var.is_owned) {
2390 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
2392 arr_conv_14_ref = (long)&arr_conv_14_var;
2394 ret_arr_ptr[o] = arr_conv_14_ref;
2396 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
2401 typedef struct LDKFilter_JCalls {
2402 atomic_size_t refcnt;
2405 jmethodID register_tx_meth;
2406 jmethodID register_output_meth;
2408 void register_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pubkey) {
2409 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2411 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2412 jbyteArray txid_arr = (*_env)->NewByteArray(_env, 32);
2413 (*_env)->SetByteArrayRegion(_env, txid_arr, 0, 32, *txid);
2414 LDKu8slice script_pubkey_var = script_pubkey;
2415 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2416 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2417 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2419 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_tx_meth, txid_arr, script_pubkey_arr);
2421 void register_output_jcall(const void* this_arg, const LDKOutPoint *outpoint, LDKu8slice script_pubkey) {
2422 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2424 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2425 LDKu8slice script_pubkey_var = script_pubkey;
2426 jbyteArray script_pubkey_arr = (*_env)->NewByteArray(_env, script_pubkey_var.datalen);
2427 (*_env)->SetByteArrayRegion(_env, script_pubkey_arr, 0, script_pubkey_var.datalen, script_pubkey_var.data);
2428 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2430 return (*_env)->CallVoidMethod(_env, obj, j_calls->register_output_meth, outpoint, script_pubkey_arr);
2432 static void LDKFilter_JCalls_free(void* this_arg) {
2433 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2434 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2436 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2437 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2441 static void* LDKFilter_JCalls_clone(const void* this_arg) {
2442 LDKFilter_JCalls *j_calls = (LDKFilter_JCalls*) this_arg;
2443 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2444 return (void*) this_arg;
2446 static inline LDKFilter LDKFilter_init (JNIEnv * env, jclass _a, jobject o) {
2447 jclass c = (*env)->GetObjectClass(env, o);
2449 LDKFilter_JCalls *calls = MALLOC(sizeof(LDKFilter_JCalls), "LDKFilter_JCalls");
2450 atomic_init(&calls->refcnt, 1);
2451 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2452 calls->o = (*env)->NewWeakGlobalRef(env, o);
2453 calls->register_tx_meth = (*env)->GetMethodID(env, c, "register_tx", "([B[B)V");
2454 CHECK(calls->register_tx_meth != NULL);
2455 calls->register_output_meth = (*env)->GetMethodID(env, c, "register_output", "(J[B)V");
2456 CHECK(calls->register_output_meth != NULL);
2459 .this_arg = (void*) calls,
2460 .register_tx = register_tx_jcall,
2461 .register_output = register_output_jcall,
2462 .free = LDKFilter_JCalls_free,
2466 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFilter_1new (JNIEnv * env, jclass _a, jobject o) {
2467 LDKFilter *res_ptr = MALLOC(sizeof(LDKFilter), "LDKFilter");
2468 *res_ptr = LDKFilter_init(env, _a, o);
2469 return (long)res_ptr;
2471 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFilter_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2472 jobject ret = (*env)->NewLocalRef(env, ((LDKFilter_JCalls*)val)->o);
2476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jbyteArray script_pubkey) {
2477 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2478 unsigned char txid_arr[32];
2479 CHECK((*_env)->GetArrayLength (_env, txid) == 32);
2480 (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2481 unsigned char (*txid_ref)[32] = &txid_arr;
2482 LDKu8slice script_pubkey_ref;
2483 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2484 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2485 (this_arg_conv->register_tx)(this_arg_conv->this_arg, txid_ref, script_pubkey_ref);
2486 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1register_1output(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jbyteArray script_pubkey) {
2490 LDKFilter* this_arg_conv = (LDKFilter*)this_arg;
2491 LDKOutPoint outpoint_conv;
2492 outpoint_conv.inner = (void*)(outpoint & (~1));
2493 outpoint_conv.is_owned = (outpoint & 1) || (outpoint == 0);
2494 LDKu8slice script_pubkey_ref;
2495 script_pubkey_ref.data = (*_env)->GetByteArrayElements (_env, script_pubkey, NULL);
2496 script_pubkey_ref.datalen = (*_env)->GetArrayLength (_env, script_pubkey);
2497 (this_arg_conv->register_output)(this_arg_conv->this_arg, &outpoint_conv, script_pubkey_ref);
2498 (*_env)->ReleaseByteArrayElements(_env, script_pubkey, (int8_t*)script_pubkey_ref.data, 0);
2501 typedef struct LDKBroadcasterInterface_JCalls {
2502 atomic_size_t refcnt;
2505 jmethodID broadcast_transaction_meth;
2506 } LDKBroadcasterInterface_JCalls;
2507 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
2508 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2510 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2511 long tx_ref = (long)&tx;
2512 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2514 return (*_env)->CallVoidMethod(_env, obj, j_calls->broadcast_transaction_meth, tx_ref);
2516 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
2517 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2518 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2520 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2521 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2525 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
2526 LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
2527 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2528 return (void*) this_arg;
2530 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
2531 jclass c = (*env)->GetObjectClass(env, o);
2533 LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
2534 atomic_init(&calls->refcnt, 1);
2535 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2536 calls->o = (*env)->NewWeakGlobalRef(env, o);
2537 calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
2538 CHECK(calls->broadcast_transaction_meth != NULL);
2540 LDKBroadcasterInterface ret = {
2541 .this_arg = (void*) calls,
2542 .broadcast_transaction = broadcast_transaction_jcall,
2543 .free = LDKBroadcasterInterface_JCalls_free,
2547 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2548 LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
2549 *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
2550 return (long)res_ptr;
2552 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2553 jobject ret = (*env)->NewLocalRef(env, ((LDKBroadcasterInterface_JCalls*)val)->o);
2557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1broadcast_1transaction(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2558 LDKBroadcasterInterface* this_arg_conv = (LDKBroadcasterInterface*)this_arg;
2559 LDKTransaction tx_conv = *(LDKTransaction*)tx;
2561 (this_arg_conv->broadcast_transaction)(this_arg_conv->this_arg, tx_conv);
2564 typedef struct LDKFeeEstimator_JCalls {
2565 atomic_size_t refcnt;
2568 jmethodID get_est_sat_per_1000_weight_meth;
2569 } LDKFeeEstimator_JCalls;
2570 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
2571 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2573 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2574 jclass confirmation_target_conv = LDKConfirmationTarget_to_java(_env, confirmation_target);
2575 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2577 return (*_env)->CallIntMethod(_env, obj, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
2579 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
2580 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2581 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2583 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2584 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2588 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
2589 LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
2590 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2591 return (void*) this_arg;
2593 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
2594 jclass c = (*env)->GetObjectClass(env, o);
2596 LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
2597 atomic_init(&calls->refcnt, 1);
2598 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2599 calls->o = (*env)->NewWeakGlobalRef(env, o);
2600 calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/enums/LDKConfirmationTarget;)I");
2601 CHECK(calls->get_est_sat_per_1000_weight_meth != NULL);
2603 LDKFeeEstimator ret = {
2604 .this_arg = (void*) calls,
2605 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
2606 .free = LDKFeeEstimator_JCalls_free,
2610 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
2611 LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
2612 *res_ptr = LDKFeeEstimator_init(env, _a, o);
2613 return (long)res_ptr;
2615 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2616 jobject ret = (*env)->NewLocalRef(env, ((LDKFeeEstimator_JCalls*)val)->o);
2620 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) {
2621 LDKFeeEstimator* this_arg_conv = (LDKFeeEstimator*)this_arg;
2622 LDKConfirmationTarget confirmation_target_conv = LDKConfirmationTarget_from_java(_env, confirmation_target);
2623 jint ret_val = (this_arg_conv->get_est_sat_per_1000_weight)(this_arg_conv->this_arg, confirmation_target_conv);
2627 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2628 LDKCVecTempl_C2TupleTempl_usize__Transaction *vec = (LDKCVecTempl_C2TupleTempl_usize__Transaction*)ptr;
2629 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_usize__Transaction));
2631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1usize_1_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2632 LDKCVecTempl_C2TupleTempl_usize__Transaction *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_usize__Transaction), "LDKCVecTempl_C2TupleTempl_usize__Transaction");
2633 ret->datalen = (*env)->GetArrayLength(env, elems);
2634 if (ret->datalen == 0) {
2637 ret->data = MALLOC(sizeof(LDKC2TupleTempl_usize__Transaction) * ret->datalen, "LDKCVecTempl_C2TupleTempl_usize__Transaction Data");
2638 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2639 for (size_t i = 0; i < ret->datalen; i++) {
2640 jlong arr_elem = java_elems[i];
2641 LDKC2TupleTempl_usize__Transaction arr_elem_conv = *(LDKC2TupleTempl_usize__Transaction*)arr_elem;
2642 FREE((void*)arr_elem);
2643 ret->data[i] = arr_elem_conv;
2645 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2649 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2650 LDKCVecTempl_Transaction *vec = (LDKCVecTempl_Transaction*)ptr;
2651 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKTransaction));
2653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1Transaction_1new(JNIEnv *env, jclass _b, jlongArray elems){
2654 LDKCVecTempl_Transaction *ret = MALLOC(sizeof(LDKCVecTempl_Transaction), "LDKCVecTempl_Transaction");
2655 ret->datalen = (*env)->GetArrayLength(env, elems);
2656 if (ret->datalen == 0) {
2659 ret->data = MALLOC(sizeof(LDKTransaction) * ret->datalen, "LDKCVecTempl_Transaction Data");
2660 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2661 for (size_t i = 0; i < ret->datalen; i++) {
2662 jlong arr_elem = java_elems[i];
2663 LDKTransaction arr_elem_conv = *(LDKTransaction*)arr_elem;
2664 FREE((void*)arr_elem);
2665 ret->data[i] = arr_elem_conv;
2667 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2671 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2672 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *vec = (LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)ptr;
2673 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut));
2675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1ThirtyTwoBytes_1_1CVecTempl_1TxOut_1new(JNIEnv *env, jclass _b, jlongArray elems){
2676 LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut), "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut");
2677 ret->datalen = (*env)->GetArrayLength(env, elems);
2678 if (ret->datalen == 0) {
2681 ret->data = MALLOC(sizeof(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut) * ret->datalen, "LDKCVecTempl_C2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut Data");
2682 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2683 for (size_t i = 0; i < ret->datalen; i++) {
2684 jlong arr_elem = java_elems[i];
2685 LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut arr_elem_conv = *(LDKC2TupleTempl_ThirtyTwoBytes__CVecTempl_TxOut*)arr_elem;
2686 FREE((void*)arr_elem);
2687 ret->data[i] = arr_elem_conv;
2689 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2693 typedef struct LDKKeysInterface_JCalls {
2694 atomic_size_t refcnt;
2697 jmethodID get_node_secret_meth;
2698 jmethodID get_destination_script_meth;
2699 jmethodID get_shutdown_pubkey_meth;
2700 jmethodID get_channel_keys_meth;
2701 jmethodID get_secure_random_bytes_meth;
2702 } LDKKeysInterface_JCalls;
2703 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
2704 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2706 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2707 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2709 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_node_secret_meth);
2710 LDKSecretKey ret_ref;
2711 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2712 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.bytes);
2715 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
2716 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2718 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2719 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2721 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_destination_script_meth);
2722 LDKCVec_u8Z ret_ref;
2723 ret_ref.data = (*_env)->GetByteArrayElements (_env, ret, NULL);
2724 ret_ref.datalen = (*_env)->GetArrayLength (_env, ret);
2727 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
2728 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2730 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2731 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2733 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_shutdown_pubkey_meth);
2734 LDKPublicKey ret_ref;
2735 CHECK((*_env)->GetArrayLength (_env, ret) == 33);
2736 (*_env)->GetByteArrayRegion (_env, ret, 0, 33, ret_ref.compressed_form);
2739 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
2740 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2742 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2743 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2745 LDKChannelKeys* ret = (LDKChannelKeys*)(*_env)->CallLongMethod(_env, obj, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
2746 LDKChannelKeys res = *ret;
2750 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
2751 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2753 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2754 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
2756 jbyteArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_secure_random_bytes_meth);
2757 LDKThirtyTwoBytes ret_ref;
2758 CHECK((*_env)->GetArrayLength (_env, ret) == 32);
2759 (*_env)->GetByteArrayRegion (_env, ret, 0, 32, ret_ref.data);
2762 static void LDKKeysInterface_JCalls_free(void* this_arg) {
2763 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2764 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
2766 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
2767 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
2771 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
2772 LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
2773 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
2774 return (void*) this_arg;
2776 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
2777 jclass c = (*env)->GetObjectClass(env, o);
2779 LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
2780 atomic_init(&calls->refcnt, 1);
2781 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
2782 calls->o = (*env)->NewWeakGlobalRef(env, o);
2783 calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()[B");
2784 CHECK(calls->get_node_secret_meth != NULL);
2785 calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()[B");
2786 CHECK(calls->get_destination_script_meth != NULL);
2787 calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()[B");
2788 CHECK(calls->get_shutdown_pubkey_meth != NULL);
2789 calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
2790 CHECK(calls->get_channel_keys_meth != NULL);
2791 calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()[B");
2792 CHECK(calls->get_secure_random_bytes_meth != NULL);
2794 LDKKeysInterface ret = {
2795 .this_arg = (void*) calls,
2796 .get_node_secret = get_node_secret_jcall,
2797 .get_destination_script = get_destination_script_jcall,
2798 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
2799 .get_channel_keys = get_channel_keys_jcall,
2800 .get_secure_random_bytes = get_secure_random_bytes_jcall,
2801 .free = LDKKeysInterface_JCalls_free,
2805 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
2806 LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2807 *res_ptr = LDKKeysInterface_init(env, _a, o);
2808 return (long)res_ptr;
2810 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
2811 jobject ret = (*env)->NewLocalRef(env, ((LDKKeysInterface_JCalls*)val)->o);
2815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1node_1secret(JNIEnv * _env, jclass _b, jlong this_arg) {
2816 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2817 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2818 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_node_secret)(this_arg_conv->this_arg).bytes);
2822 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1destination_1script(JNIEnv * _env, jclass _b, jlong this_arg) {
2823 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2824 LDKCVec_u8Z arg_var = (this_arg_conv->get_destination_script)(this_arg_conv->this_arg);
2825 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
2826 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
2830 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_arg) {
2831 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2832 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
2833 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, (this_arg_conv->get_shutdown_pubkey)(this_arg_conv->this_arg).compressed_form);
2837 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) {
2838 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2839 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2840 *ret = (this_arg_conv->get_channel_keys)(this_arg_conv->this_arg, inbound, channel_value_satoshis);
2844 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_KeysInterface_1get_1secure_1random_1bytes(JNIEnv * _env, jclass _b, jlong this_arg) {
2845 LDKKeysInterface* this_arg_conv = (LDKKeysInterface*)this_arg;
2846 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
2847 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, (this_arg_conv->get_secure_random_bytes)(this_arg_conv->this_arg).data);
2851 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2852 LDKCVecTempl_ChannelDetails *vec = (LDKCVecTempl_ChannelDetails*)ptr;
2853 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
2854 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
2855 for (size_t i = 0; i < vec->datalen; i++) {
2856 CHECK((((long)vec->data[i].inner) & 1) == 0);
2857 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
2859 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
2862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelDetails_1new(JNIEnv *env, jclass _b, jlongArray elems){
2863 LDKCVecTempl_ChannelDetails *ret = MALLOC(sizeof(LDKCVecTempl_ChannelDetails), "LDKCVecTempl_ChannelDetails");
2864 ret->datalen = (*env)->GetArrayLength(env, elems);
2865 if (ret->datalen == 0) {
2868 ret->data = MALLOC(sizeof(LDKChannelDetails) * ret->datalen, "LDKCVecTempl_ChannelDetails Data");
2869 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2870 for (size_t i = 0; i < ret->datalen; i++) {
2871 jlong arr_elem = java_elems[i];
2872 LDKChannelDetails arr_elem_conv;
2873 arr_elem_conv.inner = (void*)(arr_elem & (~1));
2874 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
2875 if (arr_elem_conv.inner != NULL)
2876 arr_elem_conv = ChannelDetails_clone(&arr_elem_conv);
2877 ret->data[i] = arr_elem_conv;
2879 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2883 static jclass LDKNetAddress_IPv4_class = NULL;
2884 static jmethodID LDKNetAddress_IPv4_meth = NULL;
2885 static jclass LDKNetAddress_IPv6_class = NULL;
2886 static jmethodID LDKNetAddress_IPv6_meth = NULL;
2887 static jclass LDKNetAddress_OnionV2_class = NULL;
2888 static jmethodID LDKNetAddress_OnionV2_meth = NULL;
2889 static jclass LDKNetAddress_OnionV3_class = NULL;
2890 static jmethodID LDKNetAddress_OnionV3_meth = NULL;
2891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_00024LDKNetAddress_init (JNIEnv * env, jclass _a) {
2892 LDKNetAddress_IPv4_class =
2893 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv4;"));
2894 CHECK(LDKNetAddress_IPv4_class != NULL);
2895 LDKNetAddress_IPv4_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv4_class, "<init>", "([BS)V");
2896 CHECK(LDKNetAddress_IPv4_meth != NULL);
2897 LDKNetAddress_IPv6_class =
2898 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$IPv6;"));
2899 CHECK(LDKNetAddress_IPv6_class != NULL);
2900 LDKNetAddress_IPv6_meth = (*env)->GetMethodID(env, LDKNetAddress_IPv6_class, "<init>", "([BS)V");
2901 CHECK(LDKNetAddress_IPv6_meth != NULL);
2902 LDKNetAddress_OnionV2_class =
2903 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV2;"));
2904 CHECK(LDKNetAddress_OnionV2_class != NULL);
2905 LDKNetAddress_OnionV2_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV2_class, "<init>", "([BS)V");
2906 CHECK(LDKNetAddress_OnionV2_meth != NULL);
2907 LDKNetAddress_OnionV3_class =
2908 (*env)->NewGlobalRef(env, (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetAddress$OnionV3;"));
2909 CHECK(LDKNetAddress_OnionV3_class != NULL);
2910 LDKNetAddress_OnionV3_meth = (*env)->GetMethodID(env, LDKNetAddress_OnionV3_class, "<init>", "([BSBS)V");
2911 CHECK(LDKNetAddress_OnionV3_meth != NULL);
2913 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKNetAddress_1ref_1from_1ptr (JNIEnv * _env, jclass _c, jlong ptr) {
2914 LDKNetAddress *obj = (LDKNetAddress*)ptr;
2916 case LDKNetAddress_IPv4: {
2917 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 4);
2918 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 4, obj->i_pv4.addr.data);
2919 return (*_env)->NewObject(_env, LDKNetAddress_IPv4_class, LDKNetAddress_IPv4_meth, addr_arr, obj->i_pv4.port);
2921 case LDKNetAddress_IPv6: {
2922 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 16);
2923 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 16, obj->i_pv6.addr.data);
2924 return (*_env)->NewObject(_env, LDKNetAddress_IPv6_class, LDKNetAddress_IPv6_meth, addr_arr, obj->i_pv6.port);
2926 case LDKNetAddress_OnionV2: {
2927 jbyteArray addr_arr = (*_env)->NewByteArray(_env, 10);
2928 (*_env)->SetByteArrayRegion(_env, addr_arr, 0, 10, obj->onion_v2.addr.data);
2929 return (*_env)->NewObject(_env, LDKNetAddress_OnionV2_class, LDKNetAddress_OnionV2_meth, addr_arr, obj->onion_v2.port);
2931 case LDKNetAddress_OnionV3: {
2932 jbyteArray ed25519_pubkey_arr = (*_env)->NewByteArray(_env, 32);
2933 (*_env)->SetByteArrayRegion(_env, ed25519_pubkey_arr, 0, 32, obj->onion_v3.ed25519_pubkey.data);
2934 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);
2939 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
2940 LDKCVecTempl_NetAddress *vec = (LDKCVecTempl_NetAddress*)ptr;
2941 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKNetAddress));
2943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NetAddress_1new(JNIEnv *env, jclass _b, jlongArray elems){
2944 LDKCVecTempl_NetAddress *ret = MALLOC(sizeof(LDKCVecTempl_NetAddress), "LDKCVecTempl_NetAddress");
2945 ret->datalen = (*env)->GetArrayLength(env, elems);
2946 if (ret->datalen == 0) {
2949 ret->data = MALLOC(sizeof(LDKNetAddress) * ret->datalen, "LDKCVecTempl_NetAddress Data");
2950 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
2951 for (size_t i = 0; i < ret->datalen; i++) {
2952 jlong arr_elem = java_elems[i];
2953 LDKNetAddress arr_elem_conv = *(LDKNetAddress*)arr_elem;
2954 FREE((void*)arr_elem);
2955 ret->data[i] = arr_elem_conv;
2957 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
2961 typedef struct LDKChannelMessageHandler_JCalls {
2962 atomic_size_t refcnt;
2965 LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
2966 jmethodID handle_open_channel_meth;
2967 jmethodID handle_accept_channel_meth;
2968 jmethodID handle_funding_created_meth;
2969 jmethodID handle_funding_signed_meth;
2970 jmethodID handle_funding_locked_meth;
2971 jmethodID handle_shutdown_meth;
2972 jmethodID handle_closing_signed_meth;
2973 jmethodID handle_update_add_htlc_meth;
2974 jmethodID handle_update_fulfill_htlc_meth;
2975 jmethodID handle_update_fail_htlc_meth;
2976 jmethodID handle_update_fail_malformed_htlc_meth;
2977 jmethodID handle_commitment_signed_meth;
2978 jmethodID handle_revoke_and_ack_meth;
2979 jmethodID handle_update_fee_meth;
2980 jmethodID handle_announcement_signatures_meth;
2981 jmethodID peer_disconnected_meth;
2982 jmethodID peer_connected_meth;
2983 jmethodID handle_channel_reestablish_meth;
2984 jmethodID handle_error_meth;
2985 } LDKChannelMessageHandler_JCalls;
2986 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
2987 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
2989 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
2990 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
2991 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
2992 LDKInitFeatures their_features_var = their_features;
2993 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
2994 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
2995 long their_features_ref;
2996 if (their_features_var.is_owned) {
2997 their_features_ref = (long)their_features_var.inner | 1;
2999 their_features_ref = (long)&their_features_var;
3001 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3003 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_open_channel_meth, their_node_id_arr, their_features_ref, msg);
3005 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
3006 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3008 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3009 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3010 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3011 LDKInitFeatures their_features_var = their_features;
3012 CHECK((((long)their_features_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3013 CHECK((((long)&their_features_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3014 long their_features_ref;
3015 if (their_features_var.is_owned) {
3016 their_features_ref = (long)their_features_var.inner | 1;
3018 their_features_ref = (long)&their_features_var;
3020 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3022 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_accept_channel_meth, their_node_id_arr, their_features_ref, msg);
3024 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
3025 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3027 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3028 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3029 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3030 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3032 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_created_meth, their_node_id_arr, msg);
3034 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
3035 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3037 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3038 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3039 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3040 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3042 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_signed_meth, their_node_id_arr, msg);
3044 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
3045 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3047 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3048 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3049 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3050 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3052 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_funding_locked_meth, their_node_id_arr, msg);
3054 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
3055 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3057 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3058 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3059 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3060 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3062 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_shutdown_meth, their_node_id_arr, msg);
3064 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
3065 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3067 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3068 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3069 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3070 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3072 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_closing_signed_meth, their_node_id_arr, msg);
3074 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
3075 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3077 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3078 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3079 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3080 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3082 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_add_htlc_meth, their_node_id_arr, msg);
3084 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
3085 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3087 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3088 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3089 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3090 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3092 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fulfill_htlc_meth, their_node_id_arr, msg);
3094 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
3095 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3097 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3098 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3099 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3100 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3102 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_htlc_meth, their_node_id_arr, msg);
3104 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
3105 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3107 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3108 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3109 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3110 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3112 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id_arr, msg);
3114 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
3115 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3117 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3118 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3119 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3120 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3122 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_commitment_signed_meth, their_node_id_arr, msg);
3124 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
3125 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3127 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3128 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3129 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3130 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3132 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_revoke_and_ack_meth, their_node_id_arr, msg);
3134 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
3135 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3137 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3138 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3139 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3140 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3142 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_update_fee_meth, their_node_id_arr, msg);
3144 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
3145 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3147 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3148 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3149 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3150 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3152 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_announcement_signatures_meth, their_node_id_arr, msg);
3154 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
3155 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3157 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3158 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3159 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3160 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3162 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_disconnected_meth, their_node_id_arr, no_connection_possible);
3164 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
3165 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3167 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3168 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3169 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3170 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3172 return (*_env)->CallVoidMethod(_env, obj, j_calls->peer_connected_meth, their_node_id_arr, msg);
3174 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
3175 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3177 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3178 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3179 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3180 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3182 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_channel_reestablish_meth, their_node_id_arr, msg);
3184 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
3185 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3187 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3188 jbyteArray their_node_id_arr = (*_env)->NewByteArray(_env, 33);
3189 (*_env)->SetByteArrayRegion(_env, their_node_id_arr, 0, 33, their_node_id.compressed_form);
3190 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3192 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_error_meth, their_node_id_arr, msg);
3194 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
3195 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3196 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3198 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3199 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3203 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
3204 LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
3205 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3206 atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
3207 return (void*) this_arg;
3209 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3210 jclass c = (*env)->GetObjectClass(env, o);
3212 LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
3213 atomic_init(&calls->refcnt, 1);
3214 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3215 calls->o = (*env)->NewWeakGlobalRef(env, o);
3216 calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "([BJJ)V");
3217 CHECK(calls->handle_open_channel_meth != NULL);
3218 calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "([BJJ)V");
3219 CHECK(calls->handle_accept_channel_meth != NULL);
3220 calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "([BJ)V");
3221 CHECK(calls->handle_funding_created_meth != NULL);
3222 calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "([BJ)V");
3223 CHECK(calls->handle_funding_signed_meth != NULL);
3224 calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "([BJ)V");
3225 CHECK(calls->handle_funding_locked_meth != NULL);
3226 calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "([BJ)V");
3227 CHECK(calls->handle_shutdown_meth != NULL);
3228 calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "([BJ)V");
3229 CHECK(calls->handle_closing_signed_meth != NULL);
3230 calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "([BJ)V");
3231 CHECK(calls->handle_update_add_htlc_meth != NULL);
3232 calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "([BJ)V");
3233 CHECK(calls->handle_update_fulfill_htlc_meth != NULL);
3234 calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "([BJ)V");
3235 CHECK(calls->handle_update_fail_htlc_meth != NULL);
3236 calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "([BJ)V");
3237 CHECK(calls->handle_update_fail_malformed_htlc_meth != NULL);
3238 calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "([BJ)V");
3239 CHECK(calls->handle_commitment_signed_meth != NULL);
3240 calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "([BJ)V");
3241 CHECK(calls->handle_revoke_and_ack_meth != NULL);
3242 calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "([BJ)V");
3243 CHECK(calls->handle_update_fee_meth != NULL);
3244 calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "([BJ)V");
3245 CHECK(calls->handle_announcement_signatures_meth != NULL);
3246 calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "([BZ)V");
3247 CHECK(calls->peer_disconnected_meth != NULL);
3248 calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "([BJ)V");
3249 CHECK(calls->peer_connected_meth != NULL);
3250 calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "([BJ)V");
3251 CHECK(calls->handle_channel_reestablish_meth != NULL);
3252 calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "([BJ)V");
3253 CHECK(calls->handle_error_meth != NULL);
3255 LDKChannelMessageHandler ret = {
3256 .this_arg = (void*) calls,
3257 .handle_open_channel = handle_open_channel_jcall,
3258 .handle_accept_channel = handle_accept_channel_jcall,
3259 .handle_funding_created = handle_funding_created_jcall,
3260 .handle_funding_signed = handle_funding_signed_jcall,
3261 .handle_funding_locked = handle_funding_locked_jcall,
3262 .handle_shutdown = handle_shutdown_jcall,
3263 .handle_closing_signed = handle_closing_signed_jcall,
3264 .handle_update_add_htlc = handle_update_add_htlc_jcall,
3265 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
3266 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
3267 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
3268 .handle_commitment_signed = handle_commitment_signed_jcall,
3269 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
3270 .handle_update_fee = handle_update_fee_jcall,
3271 .handle_announcement_signatures = handle_announcement_signatures_jcall,
3272 .peer_disconnected = peer_disconnected_jcall,
3273 .peer_connected = peer_connected_jcall,
3274 .handle_channel_reestablish = handle_channel_reestablish_jcall,
3275 .handle_error = handle_error_jcall,
3276 .free = LDKChannelMessageHandler_JCalls_free,
3277 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
3279 calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
3282 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
3283 LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3284 *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
3285 return (long)res_ptr;
3287 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3288 jobject ret = (*env)->NewLocalRef(env, ((LDKChannelMessageHandler_JCalls*)val)->o);
3292 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) {
3293 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3294 LDKPublicKey their_node_id_ref;
3295 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3296 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3297 LDKInitFeatures their_features_conv;
3298 their_features_conv.inner = (void*)(their_features & (~1));
3299 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3300 // Warning: we may need a move here but can't clone!
3301 LDKOpenChannel msg_conv;
3302 msg_conv.inner = (void*)(msg & (~1));
3303 msg_conv.is_owned = (msg & 1) || (msg == 0);
3304 (this_arg_conv->handle_open_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3307 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) {
3308 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3309 LDKPublicKey their_node_id_ref;
3310 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3311 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3312 LDKInitFeatures their_features_conv;
3313 their_features_conv.inner = (void*)(their_features & (~1));
3314 their_features_conv.is_owned = (their_features & 1) || (their_features == 0);
3315 // Warning: we may need a move here but can't clone!
3316 LDKAcceptChannel msg_conv;
3317 msg_conv.inner = (void*)(msg & (~1));
3318 msg_conv.is_owned = (msg & 1) || (msg == 0);
3319 (this_arg_conv->handle_accept_channel)(this_arg_conv->this_arg, their_node_id_ref, their_features_conv, &msg_conv);
3322 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) {
3323 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3324 LDKPublicKey their_node_id_ref;
3325 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3326 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3327 LDKFundingCreated msg_conv;
3328 msg_conv.inner = (void*)(msg & (~1));
3329 msg_conv.is_owned = (msg & 1) || (msg == 0);
3330 (this_arg_conv->handle_funding_created)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3333 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) {
3334 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3335 LDKPublicKey their_node_id_ref;
3336 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3337 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3338 LDKFundingSigned msg_conv;
3339 msg_conv.inner = (void*)(msg & (~1));
3340 msg_conv.is_owned = (msg & 1) || (msg == 0);
3341 (this_arg_conv->handle_funding_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3344 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) {
3345 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3346 LDKPublicKey their_node_id_ref;
3347 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3348 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3349 LDKFundingLocked msg_conv;
3350 msg_conv.inner = (void*)(msg & (~1));
3351 msg_conv.is_owned = (msg & 1) || (msg == 0);
3352 (this_arg_conv->handle_funding_locked)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3355 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1shutdown(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3356 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3357 LDKPublicKey their_node_id_ref;
3358 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3359 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3360 LDKShutdown msg_conv;
3361 msg_conv.inner = (void*)(msg & (~1));
3362 msg_conv.is_owned = (msg & 1) || (msg == 0);
3363 (this_arg_conv->handle_shutdown)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3366 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) {
3367 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3368 LDKPublicKey their_node_id_ref;
3369 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3370 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3371 LDKClosingSigned msg_conv;
3372 msg_conv.inner = (void*)(msg & (~1));
3373 msg_conv.is_owned = (msg & 1) || (msg == 0);
3374 (this_arg_conv->handle_closing_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3377 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) {
3378 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3379 LDKPublicKey their_node_id_ref;
3380 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3381 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3382 LDKUpdateAddHTLC msg_conv;
3383 msg_conv.inner = (void*)(msg & (~1));
3384 msg_conv.is_owned = (msg & 1) || (msg == 0);
3385 (this_arg_conv->handle_update_add_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3388 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) {
3389 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3390 LDKPublicKey their_node_id_ref;
3391 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3392 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3393 LDKUpdateFulfillHTLC msg_conv;
3394 msg_conv.inner = (void*)(msg & (~1));
3395 msg_conv.is_owned = (msg & 1) || (msg == 0);
3396 (this_arg_conv->handle_update_fulfill_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3399 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) {
3400 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3401 LDKPublicKey their_node_id_ref;
3402 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3403 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3404 LDKUpdateFailHTLC msg_conv;
3405 msg_conv.inner = (void*)(msg & (~1));
3406 msg_conv.is_owned = (msg & 1) || (msg == 0);
3407 (this_arg_conv->handle_update_fail_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3410 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) {
3411 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3412 LDKPublicKey their_node_id_ref;
3413 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3414 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3415 LDKUpdateFailMalformedHTLC msg_conv;
3416 msg_conv.inner = (void*)(msg & (~1));
3417 msg_conv.is_owned = (msg & 1) || (msg == 0);
3418 (this_arg_conv->handle_update_fail_malformed_htlc)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3421 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) {
3422 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3423 LDKPublicKey their_node_id_ref;
3424 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3425 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3426 LDKCommitmentSigned msg_conv;
3427 msg_conv.inner = (void*)(msg & (~1));
3428 msg_conv.is_owned = (msg & 1) || (msg == 0);
3429 (this_arg_conv->handle_commitment_signed)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3432 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) {
3433 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3434 LDKPublicKey their_node_id_ref;
3435 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3436 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3437 LDKRevokeAndACK msg_conv;
3438 msg_conv.inner = (void*)(msg & (~1));
3439 msg_conv.is_owned = (msg & 1) || (msg == 0);
3440 (this_arg_conv->handle_revoke_and_ack)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3443 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) {
3444 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3445 LDKPublicKey their_node_id_ref;
3446 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3447 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3448 LDKUpdateFee msg_conv;
3449 msg_conv.inner = (void*)(msg & (~1));
3450 msg_conv.is_owned = (msg & 1) || (msg == 0);
3451 (this_arg_conv->handle_update_fee)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3454 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) {
3455 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3456 LDKPublicKey their_node_id_ref;
3457 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3458 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3459 LDKAnnouncementSignatures msg_conv;
3460 msg_conv.inner = (void*)(msg & (~1));
3461 msg_conv.is_owned = (msg & 1) || (msg == 0);
3462 (this_arg_conv->handle_announcement_signatures)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3465 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) {
3466 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3467 LDKPublicKey their_node_id_ref;
3468 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3469 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3470 (this_arg_conv->peer_disconnected)(this_arg_conv->this_arg, their_node_id_ref, no_connection_possible);
3473 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1peer_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3474 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3475 LDKPublicKey their_node_id_ref;
3476 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3477 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3479 msg_conv.inner = (void*)(msg & (~1));
3480 msg_conv.is_owned = (msg & 1) || (msg == 0);
3481 (this_arg_conv->peer_connected)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3484 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) {
3485 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3486 LDKPublicKey their_node_id_ref;
3487 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3488 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3489 LDKChannelReestablish msg_conv;
3490 msg_conv.inner = (void*)(msg & (~1));
3491 msg_conv.is_owned = (msg & 1) || (msg == 0);
3492 (this_arg_conv->handle_channel_reestablish)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1handle_1error(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray their_node_id, jlong msg) {
3496 LDKChannelMessageHandler* this_arg_conv = (LDKChannelMessageHandler*)this_arg;
3497 LDKPublicKey their_node_id_ref;
3498 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
3499 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
3500 LDKErrorMessage msg_conv;
3501 msg_conv.inner = (void*)(msg & (~1));
3502 msg_conv.is_owned = (msg & 1) || (msg == 0);
3503 (this_arg_conv->handle_error)(this_arg_conv->this_arg, their_node_id_ref, &msg_conv);
3506 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3507 LDKCVecTempl_ChannelMonitor *vec = (LDKCVecTempl_ChannelMonitor*)ptr;
3508 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3509 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3510 for (size_t i = 0; i < vec->datalen; i++) {
3511 CHECK((((long)vec->data[i].inner) & 1) == 0);
3512 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3514 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1ChannelMonitor_1new(JNIEnv *env, jclass _b, jlongArray elems){
3518 LDKCVecTempl_ChannelMonitor *ret = MALLOC(sizeof(LDKCVecTempl_ChannelMonitor), "LDKCVecTempl_ChannelMonitor");
3519 ret->datalen = (*env)->GetArrayLength(env, elems);
3520 if (ret->datalen == 0) {
3523 ret->data = MALLOC(sizeof(LDKChannelMonitor) * ret->datalen, "LDKCVecTempl_ChannelMonitor Data");
3524 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3525 for (size_t i = 0; i < ret->datalen; i++) {
3526 jlong arr_elem = java_elems[i];
3527 LDKChannelMonitor arr_elem_conv;
3528 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3529 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3530 // Warning: we may need a move here but can't clone!
3531 ret->data[i] = arr_elem_conv;
3533 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3537 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3538 LDKCVecTempl_u64 *vec = (LDKCVecTempl_u64*)ptr;
3539 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(uint64_t));
3541 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1u64_1new(JNIEnv *env, jclass _b, jlongArray elems){
3542 LDKCVecTempl_u64 *ret = MALLOC(sizeof(LDKCVecTempl_u64), "LDKCVecTempl_u64");
3543 ret->datalen = (*env)->GetArrayLength(env, elems);
3544 if (ret->datalen == 0) {
3547 ret->data = MALLOC(sizeof(uint64_t) * ret->datalen, "LDKCVecTempl_u64 Data");
3548 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3549 for (size_t i = 0; i < ret->datalen; i++) {
3550 ret->data[i] = java_elems[i];
3552 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3556 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3557 LDKCVecTempl_UpdateAddHTLC *vec = (LDKCVecTempl_UpdateAddHTLC*)ptr;
3558 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3559 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3560 for (size_t i = 0; i < vec->datalen; i++) {
3561 CHECK((((long)vec->data[i].inner) & 1) == 0);
3562 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3564 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3567 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateAddHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3568 LDKCVecTempl_UpdateAddHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateAddHTLC), "LDKCVecTempl_UpdateAddHTLC");
3569 ret->datalen = (*env)->GetArrayLength(env, elems);
3570 if (ret->datalen == 0) {
3573 ret->data = MALLOC(sizeof(LDKUpdateAddHTLC) * ret->datalen, "LDKCVecTempl_UpdateAddHTLC Data");
3574 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3575 for (size_t i = 0; i < ret->datalen; i++) {
3576 jlong arr_elem = java_elems[i];
3577 LDKUpdateAddHTLC arr_elem_conv;
3578 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3579 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3580 if (arr_elem_conv.inner != NULL)
3581 arr_elem_conv = UpdateAddHTLC_clone(&arr_elem_conv);
3582 ret->data[i] = arr_elem_conv;
3584 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3588 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3589 LDKCVecTempl_UpdateFulfillHTLC *vec = (LDKCVecTempl_UpdateFulfillHTLC*)ptr;
3590 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3591 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3592 for (size_t i = 0; i < vec->datalen; i++) {
3593 CHECK((((long)vec->data[i].inner) & 1) == 0);
3594 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3596 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3599 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFulfillHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3600 LDKCVecTempl_UpdateFulfillHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFulfillHTLC), "LDKCVecTempl_UpdateFulfillHTLC");
3601 ret->datalen = (*env)->GetArrayLength(env, elems);
3602 if (ret->datalen == 0) {
3605 ret->data = MALLOC(sizeof(LDKUpdateFulfillHTLC) * ret->datalen, "LDKCVecTempl_UpdateFulfillHTLC Data");
3606 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3607 for (size_t i = 0; i < ret->datalen; i++) {
3608 jlong arr_elem = java_elems[i];
3609 LDKUpdateFulfillHTLC arr_elem_conv;
3610 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3611 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3612 if (arr_elem_conv.inner != NULL)
3613 arr_elem_conv = UpdateFulfillHTLC_clone(&arr_elem_conv);
3614 ret->data[i] = arr_elem_conv;
3616 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3620 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3621 LDKCVecTempl_UpdateFailHTLC *vec = (LDKCVecTempl_UpdateFailHTLC*)ptr;
3622 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3623 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3624 for (size_t i = 0; i < vec->datalen; i++) {
3625 CHECK((((long)vec->data[i].inner) & 1) == 0);
3626 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3628 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3632 LDKCVecTempl_UpdateFailHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailHTLC), "LDKCVecTempl_UpdateFailHTLC");
3633 ret->datalen = (*env)->GetArrayLength(env, elems);
3634 if (ret->datalen == 0) {
3637 ret->data = MALLOC(sizeof(LDKUpdateFailHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailHTLC Data");
3638 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3639 for (size_t i = 0; i < ret->datalen; i++) {
3640 jlong arr_elem = java_elems[i];
3641 LDKUpdateFailHTLC arr_elem_conv;
3642 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3643 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3644 if (arr_elem_conv.inner != NULL)
3645 arr_elem_conv = UpdateFailHTLC_clone(&arr_elem_conv);
3646 ret->data[i] = arr_elem_conv;
3648 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3652 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3653 LDKCVecTempl_UpdateFailMalformedHTLC *vec = (LDKCVecTempl_UpdateFailMalformedHTLC*)ptr;
3654 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3655 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3656 for (size_t i = 0; i < vec->datalen; i++) {
3657 CHECK((((long)vec->data[i].inner) & 1) == 0);
3658 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3660 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3663 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1UpdateFailMalformedHTLC_1new(JNIEnv *env, jclass _b, jlongArray elems){
3664 LDKCVecTempl_UpdateFailMalformedHTLC *ret = MALLOC(sizeof(LDKCVecTempl_UpdateFailMalformedHTLC), "LDKCVecTempl_UpdateFailMalformedHTLC");
3665 ret->datalen = (*env)->GetArrayLength(env, elems);
3666 if (ret->datalen == 0) {
3669 ret->data = MALLOC(sizeof(LDKUpdateFailMalformedHTLC) * ret->datalen, "LDKCVecTempl_UpdateFailMalformedHTLC Data");
3670 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3671 for (size_t i = 0; i < ret->datalen; i++) {
3672 jlong arr_elem = java_elems[i];
3673 LDKUpdateFailMalformedHTLC arr_elem_conv;
3674 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3675 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3676 if (arr_elem_conv.inner != NULL)
3677 arr_elem_conv = UpdateFailMalformedHTLC_clone(&arr_elem_conv);
3678 ret->data[i] = arr_elem_conv;
3680 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3684 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
3685 return ((LDKCResult_boolLightningErrorZ*)arg)->result_ok;
3687 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
3688 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3689 CHECK(val->result_ok);
3690 return *val->contents.result;
3692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
3693 LDKCResult_boolLightningErrorZ *val = (LDKCResult_boolLightningErrorZ*)arg;
3694 CHECK(!val->result_ok);
3695 LDKLightningError err_var = (*val->contents.err);
3696 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3697 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3699 if (err_var.is_owned) {
3700 err_ref = (long)err_var.inner | 1;
3702 err_ref = (long)&err_var;
3706 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3707 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *vec = (LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)ptr;
3708 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate));
3710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C3TupleTempl_1ChannelAnnouncement_1_1ChannelUpdate_1_1ChannelUpdate_1new(JNIEnv *env, jclass _b, jlongArray elems){
3711 LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate *ret = MALLOC(sizeof(LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate), "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate");
3712 ret->datalen = (*env)->GetArrayLength(env, elems);
3713 if (ret->datalen == 0) {
3716 ret->data = MALLOC(sizeof(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate) * ret->datalen, "LDKCVecTempl_C3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate Data");
3717 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3718 for (size_t i = 0; i < ret->datalen; i++) {
3719 jlong arr_elem = java_elems[i];
3720 LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate arr_elem_conv = *(LDKC3TupleTempl_ChannelAnnouncement__ChannelUpdate__ChannelUpdate*)arr_elem;
3721 FREE((void*)arr_elem);
3722 ret->data[i] = arr_elem_conv;
3724 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3728 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
3729 LDKCVecTempl_NodeAnnouncement *vec = (LDKCVecTempl_NodeAnnouncement*)ptr;
3730 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
3731 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
3732 for (size_t i = 0; i < vec->datalen; i++) {
3733 CHECK((((long)vec->data[i].inner) & 1) == 0);
3734 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
3736 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
3739 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1NodeAnnouncement_1new(JNIEnv *env, jclass _b, jlongArray elems){
3740 LDKCVecTempl_NodeAnnouncement *ret = MALLOC(sizeof(LDKCVecTempl_NodeAnnouncement), "LDKCVecTempl_NodeAnnouncement");
3741 ret->datalen = (*env)->GetArrayLength(env, elems);
3742 if (ret->datalen == 0) {
3745 ret->data = MALLOC(sizeof(LDKNodeAnnouncement) * ret->datalen, "LDKCVecTempl_NodeAnnouncement Data");
3746 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
3747 for (size_t i = 0; i < ret->datalen; i++) {
3748 jlong arr_elem = java_elems[i];
3749 LDKNodeAnnouncement arr_elem_conv;
3750 arr_elem_conv.inner = (void*)(arr_elem & (~1));
3751 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
3752 if (arr_elem_conv.inner != NULL)
3753 arr_elem_conv = NodeAnnouncement_clone(&arr_elem_conv);
3754 ret->data[i] = arr_elem_conv;
3756 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
3760 typedef struct LDKRoutingMessageHandler_JCalls {
3761 atomic_size_t refcnt;
3764 jmethodID handle_node_announcement_meth;
3765 jmethodID handle_channel_announcement_meth;
3766 jmethodID handle_channel_update_meth;
3767 jmethodID handle_htlc_fail_channel_update_meth;
3768 jmethodID get_next_channel_announcements_meth;
3769 jmethodID get_next_node_announcements_meth;
3770 jmethodID should_request_full_sync_meth;
3771 } LDKRoutingMessageHandler_JCalls;
3772 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
3773 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_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 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_node_announcement_meth, msg);
3779 LDKCResult_boolLightningErrorZ res = *ret;
3783 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
3784 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3786 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3787 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3789 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_announcement_meth, msg);
3790 LDKCResult_boolLightningErrorZ res = *ret;
3794 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
3795 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3797 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3798 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3800 LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*_env)->CallLongMethod(_env, obj, j_calls->handle_channel_update_meth, msg);
3801 LDKCResult_boolLightningErrorZ res = *ret;
3805 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
3806 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3808 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3809 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3811 return (*_env)->CallVoidMethod(_env, obj, j_calls->handle_htlc_fail_channel_update_meth, update);
3813 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
3814 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3816 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3817 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3819 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
3820 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_constr;
3821 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3822 if (ret_constr.datalen > 0)
3823 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
3825 ret_constr.data = NULL;
3826 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3827 for (size_t l = 0; l < ret_constr.datalen; l++) {
3828 long arr_conv_63 = ret_vals[l];
3829 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
3830 FREE((void*)arr_conv_63);
3831 ret_constr.data[l] = arr_conv_63_conv;
3833 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3836 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
3837 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3839 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3840 jbyteArray starting_point_arr = (*_env)->NewByteArray(_env, 33);
3841 (*_env)->SetByteArrayRegion(_env, starting_point_arr, 0, 33, starting_point.compressed_form);
3842 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3844 jlongArray ret = (*_env)->CallObjectMethod(_env, obj, j_calls->get_next_node_announcements_meth, starting_point_arr, batch_amount);
3845 LDKCVec_NodeAnnouncementZ ret_constr;
3846 ret_constr.datalen = (*_env)->GetArrayLength (_env, ret);
3847 if (ret_constr.datalen > 0)
3848 ret_constr.data = MALLOC(ret_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
3850 ret_constr.data = NULL;
3851 long* ret_vals = (*_env)->GetLongArrayElements (_env, ret, NULL);
3852 for (size_t s = 0; s < ret_constr.datalen; s++) {
3853 long arr_conv_18 = ret_vals[s];
3854 LDKNodeAnnouncement arr_conv_18_conv;
3855 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
3856 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
3857 if (arr_conv_18_conv.inner != NULL)
3858 arr_conv_18_conv = NodeAnnouncement_clone(&arr_conv_18_conv);
3859 ret_constr.data[s] = arr_conv_18_conv;
3861 (*_env)->ReleaseLongArrayElements (_env, ret, ret_vals, 0);
3864 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
3865 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3867 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
3868 jbyteArray node_id_arr = (*_env)->NewByteArray(_env, 33);
3869 (*_env)->SetByteArrayRegion(_env, node_id_arr, 0, 33, node_id.compressed_form);
3870 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
3872 return (*_env)->CallBooleanMethod(_env, obj, j_calls->should_request_full_sync_meth, node_id_arr);
3874 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
3875 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3876 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
3878 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
3879 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
3883 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
3884 LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
3885 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
3886 return (void*) this_arg;
3888 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
3889 jclass c = (*env)->GetObjectClass(env, o);
3891 LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
3892 atomic_init(&calls->refcnt, 1);
3893 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
3894 calls->o = (*env)->NewWeakGlobalRef(env, o);
3895 calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
3896 CHECK(calls->handle_node_announcement_meth != NULL);
3897 calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
3898 CHECK(calls->handle_channel_announcement_meth != NULL);
3899 calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
3900 CHECK(calls->handle_channel_update_meth != NULL);
3901 calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
3902 CHECK(calls->handle_htlc_fail_channel_update_meth != NULL);
3903 calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)[J");
3904 CHECK(calls->get_next_channel_announcements_meth != NULL);
3905 calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "([BB)[J");
3906 CHECK(calls->get_next_node_announcements_meth != NULL);
3907 calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "([B)Z");
3908 CHECK(calls->should_request_full_sync_meth != NULL);
3910 LDKRoutingMessageHandler ret = {
3911 .this_arg = (void*) calls,
3912 .handle_node_announcement = handle_node_announcement_jcall,
3913 .handle_channel_announcement = handle_channel_announcement_jcall,
3914 .handle_channel_update = handle_channel_update_jcall,
3915 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
3916 .get_next_channel_announcements = get_next_channel_announcements_jcall,
3917 .get_next_node_announcements = get_next_node_announcements_jcall,
3918 .should_request_full_sync = should_request_full_sync_jcall,
3919 .free = LDKRoutingMessageHandler_JCalls_free,
3923 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
3924 LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
3925 *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
3926 return (long)res_ptr;
3928 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
3929 jobject ret = (*env)->NewLocalRef(env, ((LDKRoutingMessageHandler_JCalls*)val)->o);
3933 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3934 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3935 LDKNodeAnnouncement msg_conv;
3936 msg_conv.inner = (void*)(msg & (~1));
3937 msg_conv.is_owned = (msg & 1) || (msg == 0);
3938 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3939 *ret = (this_arg_conv->handle_node_announcement)(this_arg_conv->this_arg, &msg_conv);
3943 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3944 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3945 LDKChannelAnnouncement msg_conv;
3946 msg_conv.inner = (void*)(msg & (~1));
3947 msg_conv.is_owned = (msg & 1) || (msg == 0);
3948 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3949 *ret = (this_arg_conv->handle_channel_announcement)(this_arg_conv->this_arg, &msg_conv);
3953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong msg) {
3954 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3955 LDKChannelUpdate msg_conv;
3956 msg_conv.inner = (void*)(msg & (~1));
3957 msg_conv.is_owned = (msg & 1) || (msg == 0);
3958 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
3959 *ret = (this_arg_conv->handle_channel_update)(this_arg_conv->this_arg, &msg_conv);
3963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1handle_1htlc_1fail_1channel_1update(JNIEnv * _env, jclass _b, jlong this_arg, jlong update) {
3964 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3965 LDKHTLCFailChannelUpdate* update_conv = (LDKHTLCFailChannelUpdate*)update;
3966 (this_arg_conv->handle_htlc_fail_channel_update)(this_arg_conv->this_arg, update_conv);
3969 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1channel_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jlong starting_point, jbyte batch_amount) {
3970 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3971 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ ret_var = (this_arg_conv->get_next_channel_announcements)(this_arg_conv->this_arg, starting_point, batch_amount);
3972 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3973 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3974 for (size_t l = 0; l < ret_var.datalen; l++) {
3975 long arr_conv_63_ref = (long)&ret_var.data[l];
3976 ret_arr_ptr[l] = arr_conv_63_ref;
3978 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
3982 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1get_1next_1node_1announcements(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray starting_point, jbyte batch_amount) {
3983 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
3984 LDKPublicKey starting_point_ref;
3985 CHECK((*_env)->GetArrayLength (_env, starting_point) == 33);
3986 (*_env)->GetByteArrayRegion (_env, starting_point, 0, 33, starting_point_ref.compressed_form);
3987 LDKCVec_NodeAnnouncementZ ret_var = (this_arg_conv->get_next_node_announcements)(this_arg_conv->this_arg, starting_point_ref, batch_amount);
3988 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
3989 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
3990 for (size_t s = 0; s < ret_var.datalen; s++) {
3991 LDKNodeAnnouncement arr_conv_18_var = ret_var.data[s];
3992 CHECK((((long)arr_conv_18_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
3993 CHECK((((long)&arr_conv_18_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
3994 long arr_conv_18_ref;
3995 if (arr_conv_18_var.is_owned) {
3996 arr_conv_18_ref = (long)arr_conv_18_var.inner | 1;
3998 arr_conv_18_ref = (long)&arr_conv_18_var;
4000 ret_arr_ptr[s] = arr_conv_18_ref;
4002 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
4007 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1should_1request_1full_1sync(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray node_id) {
4008 LDKRoutingMessageHandler* this_arg_conv = (LDKRoutingMessageHandler*)this_arg;
4009 LDKPublicKey node_id_ref;
4010 CHECK((*_env)->GetArrayLength (_env, node_id) == 33);
4011 (*_env)->GetByteArrayRegion (_env, node_id, 0, 33, node_id_ref.compressed_form);
4012 jboolean ret_val = (this_arg_conv->should_request_full_sync)(this_arg_conv->this_arg, node_id_ref);
4016 typedef struct LDKSocketDescriptor_JCalls {
4017 atomic_size_t refcnt;
4020 jmethodID send_data_meth;
4021 jmethodID disconnect_socket_meth;
4023 jmethodID hash_meth;
4024 } LDKSocketDescriptor_JCalls;
4025 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
4026 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4028 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4029 LDKu8slice data_var = data;
4030 jbyteArray data_arr = (*_env)->NewByteArray(_env, data_var.datalen);
4031 (*_env)->SetByteArrayRegion(_env, data_arr, 0, data_var.datalen, data_var.data);
4032 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4034 return (*_env)->CallLongMethod(_env, obj, j_calls->send_data_meth, data_arr, resume_read);
4036 void disconnect_socket_jcall(void* this_arg) {
4037 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4039 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4040 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4042 return (*_env)->CallVoidMethod(_env, obj, j_calls->disconnect_socket_meth);
4044 bool eq_jcall(const void* this_arg, const void *other_arg) {
4045 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4047 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4048 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4050 return (*_env)->CallBooleanMethod(_env, obj, j_calls->eq_meth, other_arg);
4052 uint64_t hash_jcall(const void* this_arg) {
4053 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4055 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&_env, JNI_VERSION_1_8) == JNI_OK);
4056 jobject obj = (*_env)->NewLocalRef(_env, j_calls->o);
4058 return (*_env)->CallLongMethod(_env, obj, j_calls->hash_meth);
4060 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
4061 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4062 if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
4064 DO_ASSERT((*j_calls->vm)->GetEnv(j_calls->vm, (void**)&env, JNI_VERSION_1_8) == JNI_OK);
4065 (*env)->DeleteWeakGlobalRef(env, j_calls->o);
4069 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
4070 LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
4071 atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
4072 return (void*) this_arg;
4074 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
4075 jclass c = (*env)->GetObjectClass(env, o);
4077 LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
4078 atomic_init(&calls->refcnt, 1);
4079 DO_ASSERT((*env)->GetJavaVM(env, &calls->vm) == 0);
4080 calls->o = (*env)->NewWeakGlobalRef(env, o);
4081 calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "([BZ)J");
4082 CHECK(calls->send_data_meth != NULL);
4083 calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
4084 CHECK(calls->disconnect_socket_meth != NULL);
4085 calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(J)Z");
4086 CHECK(calls->eq_meth != NULL);
4087 calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
4088 CHECK(calls->hash_meth != NULL);
4090 LDKSocketDescriptor ret = {
4091 .this_arg = (void*) calls,
4092 .send_data = send_data_jcall,
4093 .disconnect_socket = disconnect_socket_jcall,
4096 .clone = LDKSocketDescriptor_JCalls_clone,
4097 .free = LDKSocketDescriptor_JCalls_free,
4101 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
4102 LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
4103 *res_ptr = LDKSocketDescriptor_init(env, _a, o);
4104 return (long)res_ptr;
4106 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1get_1obj_1from_1jcalls (JNIEnv * env, jclass _a, jlong val) {
4107 jobject ret = (*env)->NewLocalRef(env, ((LDKSocketDescriptor_JCalls*)val)->o);
4111 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1send_1data(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray data, jboolean resume_read) {
4112 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4113 LDKu8slice data_ref;
4114 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
4115 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
4116 jlong ret_val = (this_arg_conv->send_data)(this_arg_conv->this_arg, data_ref, resume_read);
4117 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
4121 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1disconnect_1socket(JNIEnv * _env, jclass _b, jlong this_arg) {
4122 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4123 (this_arg_conv->disconnect_socket)(this_arg_conv->this_arg);
4126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1hash(JNIEnv * _env, jclass _b, jlong this_arg) {
4127 LDKSocketDescriptor* this_arg_conv = (LDKSocketDescriptor*)this_arg;
4128 jlong ret_val = (this_arg_conv->hash)(this_arg_conv->this_arg);
4132 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1PublicKey_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4133 LDKCVecTempl_PublicKey *vec = (LDKCVecTempl_PublicKey*)ptr;
4134 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKPublicKey));
4136 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4137 return ((LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg)->result_ok;
4139 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4140 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4141 CHECK(val->result_ok);
4142 LDKCVecTempl_u8 res_var = (*val->contents.result);
4143 jbyteArray res_arr = (*_env)->NewByteArray(_env, res_var.datalen);
4144 (*_env)->SetByteArrayRegion(_env, res_arr, 0, res_var.datalen, res_var.data);
4147 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1CVec_1u8ZPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4148 LDKCResult_CVec_u8ZPeerHandleErrorZ *val = (LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4149 CHECK(!val->result_ok);
4150 LDKPeerHandleError err_var = (*val->contents.err);
4151 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4152 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4154 if (err_var.is_owned) {
4155 err_ref = (long)err_var.inner | 1;
4157 err_ref = (long)&err_var;
4161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4162 return ((LDKCResult_boolPeerHandleErrorZ*)arg)->result_ok;
4164 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4165 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4166 CHECK(val->result_ok);
4167 return *val->contents.result;
4169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1boolPeerHandleErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4170 LDKCResult_boolPeerHandleErrorZ *val = (LDKCResult_boolPeerHandleErrorZ*)arg;
4171 CHECK(!val->result_ok);
4172 LDKPeerHandleError err_var = (*val->contents.err);
4173 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4174 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4176 if (err_var.is_owned) {
4177 err_ref = (long)err_var.inner | 1;
4179 err_ref = (long)&err_var;
4183 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4184 return ((LDKCResult_SecretKeySecpErrorZ*)arg)->result_ok;
4186 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4187 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4188 CHECK(val->result_ok);
4189 jbyteArray res_arr = (*_env)->NewByteArray(_env, 32);
4190 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 32, (*val->contents.result).bytes);
4193 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1SecretKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4194 LDKCResult_SecretKeySecpErrorZ *val = (LDKCResult_SecretKeySecpErrorZ*)arg;
4195 CHECK(!val->result_ok);
4196 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4199 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4200 return ((LDKCResult_PublicKeySecpErrorZ*)arg)->result_ok;
4202 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4203 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4204 CHECK(val->result_ok);
4205 jbyteArray res_arr = (*_env)->NewByteArray(_env, 33);
4206 (*_env)->SetByteArrayRegion(_env, res_arr, 0, 33, (*val->contents.result).compressed_form);
4209 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1PublicKeySecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4210 LDKCResult_PublicKeySecpErrorZ *val = (LDKCResult_PublicKeySecpErrorZ*)arg;
4211 CHECK(!val->result_ok);
4212 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4215 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4216 return ((LDKCResult_TxCreationKeysSecpErrorZ*)arg)->result_ok;
4218 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4219 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4220 CHECK(val->result_ok);
4221 LDKTxCreationKeys res_var = (*val->contents.result);
4222 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4223 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4225 if (res_var.is_owned) {
4226 res_ref = (long)res_var.inner | 1;
4228 res_ref = (long)&res_var;
4232 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_LDKCResult_1TxCreationKeysSecpErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4233 LDKCResult_TxCreationKeysSecpErrorZ *val = (LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4234 CHECK(!val->result_ok);
4235 jclass err_conv = LDKSecp256k1Error_to_java(_env, (*val->contents.err));
4238 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4239 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *vec = (LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature*)ptr;
4240 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature));
4242 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1C2TupleTempl_1HTLCOutputInCommitment_1_1Signature_1new(JNIEnv *env, jclass _b, jlongArray elems){
4243 LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature *ret = MALLOC(sizeof(LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature), "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature");
4244 ret->datalen = (*env)->GetArrayLength(env, elems);
4245 if (ret->datalen == 0) {
4248 ret->data = MALLOC(sizeof(LDKC2TupleTempl_HTLCOutputInCommitment__Signature) * ret->datalen, "LDKCVecTempl_C2TupleTempl_HTLCOutputInCommitment__Signature Data");
4249 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4250 for (size_t i = 0; i < ret->datalen; i++) {
4251 jlong arr_elem = java_elems[i];
4252 LDKC2TupleTempl_HTLCOutputInCommitment__Signature arr_elem_conv = *(LDKC2TupleTempl_HTLCOutputInCommitment__Signature*)arr_elem;
4253 FREE((void*)arr_elem);
4254 ret->data[i] = arr_elem_conv;
4256 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4260 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4261 LDKCVecTempl_RouteHop *vec = (LDKCVecTempl_RouteHop*)ptr;
4262 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4263 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4264 for (size_t i = 0; i < vec->datalen; i++) {
4265 CHECK((((long)vec->data[i].inner) & 1) == 0);
4266 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4268 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHop_1new(JNIEnv *env, jclass _b, jlongArray elems){
4272 LDKCVecTempl_RouteHop *ret = MALLOC(sizeof(LDKCVecTempl_RouteHop), "LDKCVecTempl_RouteHop");
4273 ret->datalen = (*env)->GetArrayLength(env, elems);
4274 if (ret->datalen == 0) {
4277 ret->data = MALLOC(sizeof(LDKRouteHop) * ret->datalen, "LDKCVecTempl_RouteHop Data");
4278 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4279 for (size_t i = 0; i < ret->datalen; i++) {
4280 jlong arr_elem = java_elems[i];
4281 LDKRouteHop arr_elem_conv;
4282 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4283 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4284 if (arr_elem_conv.inner != NULL)
4285 arr_elem_conv = RouteHop_clone(&arr_elem_conv);
4286 ret->data[i] = arr_elem_conv;
4288 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4292 JNIEXPORT jobject JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1CVecTempl_1RouteHop_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4293 LDKCVecTempl_CVecTempl_RouteHop *vec = (LDKCVecTempl_CVecTempl_RouteHop*)ptr;
4294 return (*env)->NewObject(env, slicedef_cls, slicedef_meth, (long)vec->data, (long)vec->datalen, sizeof(LDKCVecTempl_RouteHop));
4296 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1result_1ok (JNIEnv * env, jclass _a, jlong arg) {
4297 return ((LDKCResult_RouteLightningErrorZ*)arg)->result_ok;
4299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1ok (JNIEnv * _env, jclass _a, jlong arg) {
4300 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4301 CHECK(val->result_ok);
4302 LDKRoute res_var = (*val->contents.result);
4303 CHECK((((long)res_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4304 CHECK((((long)&res_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4306 if (res_var.is_owned) {
4307 res_ref = (long)res_var.inner | 1;
4309 res_ref = (long)&res_var;
4313 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCResult_1RouteLightningErrorZ_1get_1err (JNIEnv * _env, jclass _a, jlong arg) {
4314 LDKCResult_RouteLightningErrorZ *val = (LDKCResult_RouteLightningErrorZ*)arg;
4315 CHECK(!val->result_ok);
4316 LDKLightningError err_var = (*val->contents.err);
4317 CHECK((((long)err_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
4318 CHECK((((long)&err_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
4320 if (err_var.is_owned) {
4321 err_ref = (long)err_var.inner | 1;
4323 err_ref = (long)&err_var;
4327 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1arr_1info(JNIEnv *env, jclass _b, jlong ptr) {
4328 LDKCVecTempl_RouteHint *vec = (LDKCVecTempl_RouteHint*)ptr;
4329 jlongArray ret = (*env)->NewLongArray(env, vec->datalen);
4330 jlong *ret_elems = (*env)->GetPrimitiveArrayCritical(env, ret, NULL);
4331 for (size_t i = 0; i < vec->datalen; i++) {
4332 CHECK((((long)vec->data[i].inner) & 1) == 0);
4333 ret_elems[i] = (long)vec->data[i].inner | (vec->data[i].is_owned ? 1 : 0);
4335 (*env)->ReleasePrimitiveArrayCritical(env, ret, ret_elems, 0);
4338 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKCVecTempl_1RouteHint_1new(JNIEnv *env, jclass _b, jlongArray elems){
4339 LDKCVecTempl_RouteHint *ret = MALLOC(sizeof(LDKCVecTempl_RouteHint), "LDKCVecTempl_RouteHint");
4340 ret->datalen = (*env)->GetArrayLength(env, elems);
4341 if (ret->datalen == 0) {
4344 ret->data = MALLOC(sizeof(LDKRouteHint) * ret->datalen, "LDKCVecTempl_RouteHint Data");
4345 jlong *java_elems = (*env)->GetPrimitiveArrayCritical(env, elems, NULL);
4346 for (size_t i = 0; i < ret->datalen; i++) {
4347 jlong arr_elem = java_elems[i];
4348 LDKRouteHint arr_elem_conv;
4349 arr_elem_conv.inner = (void*)(arr_elem & (~1));
4350 arr_elem_conv.is_owned = (arr_elem & 1) || (arr_elem == 0);
4351 if (arr_elem_conv.inner != NULL)
4352 arr_elem_conv = RouteHint_clone(&arr_elem_conv);
4353 ret->data[i] = arr_elem_conv;
4355 (*env)->ReleasePrimitiveArrayCritical(env, elems, java_elems, 0);
4359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4360 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
4362 C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
4365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4366 LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
4368 C2Tuple_OutPointScriptZ_free(arg_conv);
4371 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4372 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4374 C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
4377 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4378 LDKC2Tuple_TxidCVec_TxOutZZ arg_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arg;
4380 C2Tuple_TxidCVec_TxOutZZ_free(arg_conv);
4383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
4384 LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
4386 C2Tuple_u64u64Z_free(arg_conv);
4389 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4390 LDKC2Tuple_usizeTransactionZ arg_conv = *(LDKC2Tuple_usizeTransactionZ*)arg;
4392 C2Tuple_usizeTransactionZ_free(arg_conv);
4395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4396 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
4398 C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
4401 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4402 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
4404 CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
4407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4408 LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
4410 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
4411 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
4415 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4416 LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
4418 CResult_CVec_SignatureZNoneZ_free(arg_conv);
4421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jobjectArray arg) {
4422 LDKCVec_SignatureZ arg_constr;
4423 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4424 if (arg_constr.datalen > 0)
4425 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
4427 arg_constr.data = NULL;
4428 for (size_t i = 0; i < arg_constr.datalen; i++) {
4429 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4430 LDKSignature arr_conv_8_ref;
4431 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
4432 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
4433 arg_constr.data[i] = arr_conv_8_ref;
4435 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
4436 *ret = CResult_CVec_SignatureZNoneZ_ok(arg_constr);
4440 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4441 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4443 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4444 *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
4448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4449 LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
4451 CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
4454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4455 LDKCVec_u8Z arg_ref;
4456 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
4457 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
4458 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
4459 *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_ref);
4460 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
4464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4465 LDKAPIError arg_conv = *(LDKAPIError*)arg;
4467 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
4468 *ret = CResult_NoneAPIErrorZ_err(arg_conv);
4472 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4473 LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
4475 CResult_NoneAPIErrorZ_free(arg_conv);
4478 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4479 LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
4481 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
4482 *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
4486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4487 LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
4489 CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
4492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4493 LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
4495 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
4496 *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
4500 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4501 LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
4503 CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
4506 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4507 LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
4509 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
4510 *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
4514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4515 LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
4517 CResult_NonePaymentSendFailureZ_free(arg_conv);
4520 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4521 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4523 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
4524 *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
4528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4529 LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
4531 CResult_NonePeerHandleErrorZ_free(arg_conv);
4534 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4535 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4537 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4538 *ret = CResult_PublicKeySecpErrorZ_err(arg_conv);
4542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4543 LDKCResult_PublicKeySecpErrorZ arg_conv = *(LDKCResult_PublicKeySecpErrorZ*)arg;
4545 CResult_PublicKeySecpErrorZ_free(arg_conv);
4548 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1PublicKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4549 LDKPublicKey arg_ref;
4550 CHECK((*_env)->GetArrayLength (_env, arg) == 33);
4551 (*_env)->GetByteArrayRegion (_env, arg, 0, 33, arg_ref.compressed_form);
4552 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
4553 *ret = CResult_PublicKeySecpErrorZ_ok(arg_ref);
4557 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4558 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4560 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4561 *ret = CResult_RouteLightningErrorZ_err(arg_conv);
4565 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4566 LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
4568 CResult_RouteLightningErrorZ_free(arg_conv);
4571 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4572 LDKRoute arg_conv = *(LDKRoute*)arg;
4574 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
4575 *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
4579 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4580 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4582 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4583 *ret = CResult_SecretKeySecpErrorZ_err(arg_conv);
4587 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4588 LDKCResult_SecretKeySecpErrorZ arg_conv = *(LDKCResult_SecretKeySecpErrorZ*)arg;
4590 CResult_SecretKeySecpErrorZ_free(arg_conv);
4593 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SecretKeySecpErrorZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4594 LDKSecretKey arg_ref;
4595 CHECK((*_env)->GetArrayLength (_env, arg) == 32);
4596 (*_env)->GetByteArrayRegion (_env, arg, 0, 32, arg_ref.bytes);
4597 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
4598 *ret = CResult_SecretKeySecpErrorZ_ok(arg_ref);
4602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4603 LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
4605 CResult_SignatureNoneZ_free(arg_conv);
4608 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jbyteArray arg) {
4609 LDKSignature arg_ref;
4610 CHECK((*_env)->GetArrayLength (_env, arg) == 64);
4611 (*_env)->GetByteArrayRegion (_env, arg, 0, 64, arg_ref.compact_form);
4612 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
4613 *ret = CResult_SignatureNoneZ_ok(arg_ref);
4617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4618 LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
4620 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4621 *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
4625 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4626 LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
4628 CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
4631 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4632 LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
4634 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
4635 *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
4639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
4640 LDKAccessError arg_conv = *(LDKAccessError*)arg;
4642 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4643 *ret = CResult_TxOutAccessErrorZ_err(arg_conv);
4647 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4648 LDKCResult_TxOutAccessErrorZ arg_conv = *(LDKCResult_TxOutAccessErrorZ*)arg;
4650 CResult_TxOutAccessErrorZ_free(arg_conv);
4653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxOutAccessErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
4654 LDKTxOut arg_conv = *(LDKTxOut*)arg;
4656 LDKCResult_TxOutAccessErrorZ* ret = MALLOC(sizeof(LDKCResult_TxOutAccessErrorZ), "LDKCResult_TxOutAccessErrorZ");
4657 *ret = CResult_TxOutAccessErrorZ_ok(arg_conv);
4661 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4662 LDKLightningError arg_conv = *(LDKLightningError*)arg;
4664 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4665 *ret = CResult_boolLightningErrorZ_err(arg_conv);
4669 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4670 LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
4672 CResult_boolLightningErrorZ_free(arg_conv);
4675 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4676 LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
4677 *ret = CResult_boolLightningErrorZ_ok(arg);
4681 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
4682 LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
4684 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4685 *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
4689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
4690 LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
4692 CResult_boolPeerHandleErrorZ_free(arg_conv);
4695 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
4696 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
4697 *ret = CResult_boolPeerHandleErrorZ_ok(arg);
4701 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4702 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_constr;
4703 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4704 if (arg_constr.datalen > 0)
4705 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
4707 arg_constr.data = NULL;
4708 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4709 for (size_t q = 0; q < arg_constr.datalen; q++) {
4710 long arr_conv_42 = arg_vals[q];
4711 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
4712 FREE((void*)arr_conv_42);
4713 arg_constr.data[q] = arr_conv_42_conv;
4715 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4716 CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_constr);
4719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1TxidCVec_1TxOutZZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4720 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ arg_constr;
4721 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4722 if (arg_constr.datalen > 0)
4723 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKCVec_C2Tuple_TxidCVec_TxOutZZZ Elements");
4725 arg_constr.data = NULL;
4726 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4727 for (size_t b = 0; b < arg_constr.datalen; b++) {
4728 long arr_conv_27 = arg_vals[b];
4729 LDKC2Tuple_TxidCVec_TxOutZZ arr_conv_27_conv = *(LDKC2Tuple_TxidCVec_TxOutZZ*)arr_conv_27;
4730 FREE((void*)arr_conv_27);
4731 arg_constr.data[b] = arr_conv_27_conv;
4733 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4734 CVec_C2Tuple_TxidCVec_TxOutZZZ_free(arg_constr);
4737 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1usizeTransactionZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4738 LDKCVec_C2Tuple_usizeTransactionZZ arg_constr;
4739 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4740 if (arg_constr.datalen > 0)
4741 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
4743 arg_constr.data = NULL;
4744 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4745 for (size_t d = 0; d < arg_constr.datalen; d++) {
4746 long arr_conv_29 = arg_vals[d];
4747 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
4748 FREE((void*)arr_conv_29);
4749 arg_constr.data[d] = arr_conv_29_conv;
4751 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4752 CVec_C2Tuple_usizeTransactionZZ_free(arg_constr);
4755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4756 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_constr;
4757 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4758 if (arg_constr.datalen > 0)
4759 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ Elements");
4761 arg_constr.data = NULL;
4762 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4763 for (size_t l = 0; l < arg_constr.datalen; l++) {
4764 long arr_conv_63 = arg_vals[l];
4765 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arr_conv_63_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arr_conv_63;
4766 FREE((void*)arr_conv_63);
4767 arg_constr.data[l] = arr_conv_63_conv;
4769 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4770 CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_constr);
4773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4774 LDKCVec_CVec_RouteHopZZ arg_constr;
4775 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4776 if (arg_constr.datalen > 0)
4777 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
4779 arg_constr.data = NULL;
4780 for (size_t m = 0; m < arg_constr.datalen; m++) {
4781 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, arg, m);
4782 LDKCVec_RouteHopZ arr_conv_12_constr;
4783 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
4784 if (arr_conv_12_constr.datalen > 0)
4785 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4787 arr_conv_12_constr.data = NULL;
4788 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
4789 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
4790 long arr_conv_10 = arr_conv_12_vals[k];
4791 LDKRouteHop arr_conv_10_conv;
4792 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4793 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
4794 arr_conv_12_constr.data[k] = arr_conv_10_conv;
4796 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
4797 arg_constr.data[m] = arr_conv_12_constr;
4799 CVec_CVec_RouteHopZZ_free(arg_constr);
4802 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4803 LDKCVec_ChannelDetailsZ arg_constr;
4804 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4805 if (arg_constr.datalen > 0)
4806 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
4808 arg_constr.data = NULL;
4809 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4810 for (size_t q = 0; q < arg_constr.datalen; q++) {
4811 long arr_conv_16 = arg_vals[q];
4812 LDKChannelDetails arr_conv_16_conv;
4813 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4814 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4815 arg_constr.data[q] = arr_conv_16_conv;
4817 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4818 CVec_ChannelDetailsZ_free(arg_constr);
4821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4822 LDKCVec_ChannelMonitorZ arg_constr;
4823 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4824 if (arg_constr.datalen > 0)
4825 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
4827 arg_constr.data = NULL;
4828 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4829 for (size_t q = 0; q < arg_constr.datalen; q++) {
4830 long arr_conv_16 = arg_vals[q];
4831 LDKChannelMonitor arr_conv_16_conv;
4832 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
4833 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
4834 arg_constr.data[q] = arr_conv_16_conv;
4836 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4837 CVec_ChannelMonitorZ_free(arg_constr);
4840 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4841 LDKCVec_EventZ arg_constr;
4842 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4843 if (arg_constr.datalen > 0)
4844 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKEvent), "LDKCVec_EventZ Elements");
4846 arg_constr.data = NULL;
4847 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4848 for (size_t h = 0; h < arg_constr.datalen; h++) {
4849 long arr_conv_7 = arg_vals[h];
4850 LDKEvent arr_conv_7_conv = *(LDKEvent*)arr_conv_7;
4851 FREE((void*)arr_conv_7);
4852 arg_constr.data[h] = arr_conv_7_conv;
4854 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4855 CVec_EventZ_free(arg_constr);
4858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4859 LDKCVec_HTLCOutputInCommitmentZ arg_constr;
4860 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4861 if (arg_constr.datalen > 0)
4862 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKHTLCOutputInCommitment), "LDKCVec_HTLCOutputInCommitmentZ Elements");
4864 arg_constr.data = NULL;
4865 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4866 for (size_t y = 0; y < arg_constr.datalen; y++) {
4867 long arr_conv_24 = arg_vals[y];
4868 LDKHTLCOutputInCommitment arr_conv_24_conv;
4869 arr_conv_24_conv.inner = (void*)(arr_conv_24 & (~1));
4870 arr_conv_24_conv.is_owned = (arr_conv_24 & 1) || (arr_conv_24 == 0);
4871 arg_constr.data[y] = arr_conv_24_conv;
4873 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4874 CVec_HTLCOutputInCommitmentZ_free(arg_constr);
4877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4878 LDKCVec_MessageSendEventZ arg_constr;
4879 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4880 if (arg_constr.datalen > 0)
4881 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMessageSendEvent), "LDKCVec_MessageSendEventZ Elements");
4883 arg_constr.data = NULL;
4884 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4885 for (size_t s = 0; s < arg_constr.datalen; s++) {
4886 long arr_conv_18 = arg_vals[s];
4887 LDKMessageSendEvent arr_conv_18_conv = *(LDKMessageSendEvent*)arr_conv_18;
4888 FREE((void*)arr_conv_18);
4889 arg_constr.data[s] = arr_conv_18_conv;
4891 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4892 CVec_MessageSendEventZ_free(arg_constr);
4895 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4896 LDKCVec_MonitorEventZ arg_constr;
4897 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4898 if (arg_constr.datalen > 0)
4899 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKMonitorEvent), "LDKCVec_MonitorEventZ Elements");
4901 arg_constr.data = NULL;
4902 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4903 for (size_t o = 0; o < arg_constr.datalen; o++) {
4904 long arr_conv_14 = arg_vals[o];
4905 LDKMonitorEvent arr_conv_14_conv;
4906 arr_conv_14_conv.inner = (void*)(arr_conv_14 & (~1));
4907 arr_conv_14_conv.is_owned = (arr_conv_14 & 1) || (arr_conv_14 == 0);
4908 arg_constr.data[o] = arr_conv_14_conv;
4910 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4911 CVec_MonitorEventZ_free(arg_constr);
4914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4915 LDKCVec_NetAddressZ arg_constr;
4916 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4917 if (arg_constr.datalen > 0)
4918 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
4920 arg_constr.data = NULL;
4921 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4922 for (size_t m = 0; m < arg_constr.datalen; m++) {
4923 long arr_conv_12 = arg_vals[m];
4924 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
4925 FREE((void*)arr_conv_12);
4926 arg_constr.data[m] = arr_conv_12_conv;
4928 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4929 CVec_NetAddressZ_free(arg_constr);
4932 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4933 LDKCVec_NodeAnnouncementZ arg_constr;
4934 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4935 if (arg_constr.datalen > 0)
4936 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKNodeAnnouncement), "LDKCVec_NodeAnnouncementZ Elements");
4938 arg_constr.data = NULL;
4939 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4940 for (size_t s = 0; s < arg_constr.datalen; s++) {
4941 long arr_conv_18 = arg_vals[s];
4942 LDKNodeAnnouncement arr_conv_18_conv;
4943 arr_conv_18_conv.inner = (void*)(arr_conv_18 & (~1));
4944 arr_conv_18_conv.is_owned = (arr_conv_18 & 1) || (arr_conv_18 == 0);
4945 arg_constr.data[s] = arr_conv_18_conv;
4947 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4948 CVec_NodeAnnouncementZ_free(arg_constr);
4951 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
4952 LDKCVec_PublicKeyZ arg_constr;
4953 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4954 if (arg_constr.datalen > 0)
4955 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKPublicKey), "LDKCVec_PublicKeyZ Elements");
4957 arg_constr.data = NULL;
4958 for (size_t i = 0; i < arg_constr.datalen; i++) {
4959 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
4960 LDKPublicKey arr_conv_8_ref;
4961 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 33);
4962 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 33, arr_conv_8_ref.compressed_form);
4963 arg_constr.data[i] = arr_conv_8_ref;
4965 CVec_PublicKeyZ_free(arg_constr);
4968 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4969 LDKCVec_RouteHintZ arg_constr;
4970 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4971 if (arg_constr.datalen > 0)
4972 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
4974 arg_constr.data = NULL;
4975 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4976 for (size_t l = 0; l < arg_constr.datalen; l++) {
4977 long arr_conv_11 = arg_vals[l];
4978 LDKRouteHint arr_conv_11_conv;
4979 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
4980 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
4981 arg_constr.data[l] = arr_conv_11_conv;
4983 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
4984 CVec_RouteHintZ_free(arg_constr);
4987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
4988 LDKCVec_RouteHopZ arg_constr;
4989 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
4990 if (arg_constr.datalen > 0)
4991 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
4993 arg_constr.data = NULL;
4994 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
4995 for (size_t k = 0; k < arg_constr.datalen; k++) {
4996 long arr_conv_10 = arg_vals[k];
4997 LDKRouteHop arr_conv_10_conv;
4998 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
4999 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
5000 arg_constr.data[k] = arr_conv_10_conv;
5002 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5003 CVec_RouteHopZ_free(arg_constr);
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jobjectArray arg) {
5007 LDKCVec_SignatureZ arg_constr;
5008 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5009 if (arg_constr.datalen > 0)
5010 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5012 arg_constr.data = NULL;
5013 for (size_t i = 0; i < arg_constr.datalen; i++) {
5014 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, arg, i);
5015 LDKSignature arr_conv_8_ref;
5016 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5017 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5018 arg_constr.data[i] = arr_conv_8_ref;
5020 CVec_SignatureZ_free(arg_constr);
5023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5024 LDKCVec_SpendableOutputDescriptorZ arg_constr;
5025 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5026 if (arg_constr.datalen > 0)
5027 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKSpendableOutputDescriptor), "LDKCVec_SpendableOutputDescriptorZ Elements");
5029 arg_constr.data = NULL;
5030 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5031 for (size_t b = 0; b < arg_constr.datalen; b++) {
5032 long arr_conv_27 = arg_vals[b];
5033 LDKSpendableOutputDescriptor arr_conv_27_conv = *(LDKSpendableOutputDescriptor*)arr_conv_27;
5034 FREE((void*)arr_conv_27);
5035 arg_constr.data[b] = arr_conv_27_conv;
5037 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5038 CVec_SpendableOutputDescriptorZ_free(arg_constr);
5041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5042 LDKCVec_TransactionZ arg_constr;
5043 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5044 if (arg_constr.datalen > 0)
5045 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTransaction), "LDKCVec_TransactionZ Elements");
5047 arg_constr.data = NULL;
5048 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5049 for (size_t n = 0; n < arg_constr.datalen; n++) {
5050 long arr_conv_13 = arg_vals[n];
5051 LDKTransaction arr_conv_13_conv = *(LDKTransaction*)arr_conv_13;
5052 FREE((void*)arr_conv_13);
5053 arg_constr.data[n] = arr_conv_13_conv;
5055 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5056 CVec_TransactionZ_free(arg_constr);
5059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TxOutZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5060 LDKCVec_TxOutZ arg_constr;
5061 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5062 if (arg_constr.datalen > 0)
5063 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5065 arg_constr.data = NULL;
5066 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5067 for (size_t h = 0; h < arg_constr.datalen; h++) {
5068 long arr_conv_7 = arg_vals[h];
5069 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5070 FREE((void*)arr_conv_7);
5071 arg_constr.data[h] = arr_conv_7_conv;
5073 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5074 CVec_TxOutZ_free(arg_constr);
5077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5078 LDKCVec_UpdateAddHTLCZ arg_constr;
5079 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5080 if (arg_constr.datalen > 0)
5081 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
5083 arg_constr.data = NULL;
5084 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5085 for (size_t p = 0; p < arg_constr.datalen; p++) {
5086 long arr_conv_15 = arg_vals[p];
5087 LDKUpdateAddHTLC arr_conv_15_conv;
5088 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
5089 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
5090 arg_constr.data[p] = arr_conv_15_conv;
5092 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5093 CVec_UpdateAddHTLCZ_free(arg_constr);
5096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5097 LDKCVec_UpdateFailHTLCZ arg_constr;
5098 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5099 if (arg_constr.datalen > 0)
5100 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
5102 arg_constr.data = NULL;
5103 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5104 for (size_t q = 0; q < arg_constr.datalen; q++) {
5105 long arr_conv_16 = arg_vals[q];
5106 LDKUpdateFailHTLC arr_conv_16_conv;
5107 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
5108 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
5109 arg_constr.data[q] = arr_conv_16_conv;
5111 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5112 CVec_UpdateFailHTLCZ_free(arg_constr);
5115 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5116 LDKCVec_UpdateFailMalformedHTLCZ arg_constr;
5117 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5118 if (arg_constr.datalen > 0)
5119 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
5121 arg_constr.data = NULL;
5122 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5123 for (size_t z = 0; z < arg_constr.datalen; z++) {
5124 long arr_conv_25 = arg_vals[z];
5125 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
5126 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
5127 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
5128 arg_constr.data[z] = arr_conv_25_conv;
5130 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5131 CVec_UpdateFailMalformedHTLCZ_free(arg_constr);
5134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5135 LDKCVec_UpdateFulfillHTLCZ arg_constr;
5136 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5137 if (arg_constr.datalen > 0)
5138 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
5140 arg_constr.data = NULL;
5141 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5142 for (size_t t = 0; t < arg_constr.datalen; t++) {
5143 long arr_conv_19 = arg_vals[t];
5144 LDKUpdateFulfillHTLC arr_conv_19_conv;
5145 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
5146 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
5147 arg_constr.data[t] = arr_conv_19_conv;
5149 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5150 CVec_UpdateFulfillHTLCZ_free(arg_constr);
5153 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlongArray arg) {
5154 LDKCVec_u64Z arg_constr;
5155 arg_constr.datalen = (*_env)->GetArrayLength (_env, arg);
5156 if (arg_constr.datalen > 0)
5157 arg_constr.data = MALLOC(arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
5159 arg_constr.data = NULL;
5160 long* arg_vals = (*_env)->GetLongArrayElements (_env, arg, NULL);
5161 for (size_t g = 0; g < arg_constr.datalen; g++) {
5162 long arr_conv_6 = arg_vals[g];
5163 arg_constr.data[g] = arr_conv_6;
5165 (*_env)->ReleaseLongArrayElements (_env, arg, arg_vals, 0);
5166 CVec_u64Z_free(arg_constr);
5169 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jbyteArray arg) {
5170 LDKCVec_u8Z arg_ref;
5171 arg_ref.data = (*_env)->GetByteArrayElements (_env, arg, NULL);
5172 arg_ref.datalen = (*_env)->GetArrayLength (_env, arg);
5173 CVec_u8Z_free(arg_ref);
5174 (*_env)->ReleaseByteArrayElements(_env, arg, (int8_t*)arg_ref.data, 0);
5177 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Transaction_1free(JNIEnv * _env, jclass _b, jlong _res) {
5178 LDKTransaction _res_conv = *(LDKTransaction*)_res;
5180 Transaction_free(_res_conv);
5183 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
5184 LDKTxOut _res_conv = *(LDKTxOut*)_res;
5186 TxOut_free(_res_conv);
5189 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1usizeTransactionZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5190 LDKTransaction b_conv = *(LDKTransaction*)b;
5192 LDKC2Tuple_usizeTransactionZ* ret = MALLOC(sizeof(LDKC2Tuple_usizeTransactionZ), "LDKC2Tuple_usizeTransactionZ");
5193 *ret = C2Tuple_usizeTransactionZ_new(a, b_conv);
5197 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
5198 LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
5199 *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
5203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
5204 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
5205 *ret = CResult_NoneMonitorUpdateErrorZ_ok();
5209 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5211 a_conv.inner = (void*)(a & (~1));
5212 a_conv.is_owned = (a & 1) || (a == 0);
5213 if (a_conv.inner != NULL)
5214 a_conv = OutPoint_clone(&a_conv);
5216 b_ref.data = (*_env)->GetByteArrayElements (_env, b, NULL);
5217 b_ref.datalen = (*_env)->GetArrayLength (_env, b);
5218 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
5219 *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_ref);
5220 (*_env)->ReleaseByteArrayElements(_env, b, (int8_t*)b_ref.data, 0);
5224 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1TxidCVec_1TxOutZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jlongArray b) {
5225 LDKThirtyTwoBytes a_ref;
5226 CHECK((*_env)->GetArrayLength (_env, a) == 32);
5227 (*_env)->GetByteArrayRegion (_env, a, 0, 32, a_ref.data);
5228 LDKCVec_TxOutZ b_constr;
5229 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5230 if (b_constr.datalen > 0)
5231 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKTxOut), "LDKCVec_TxOutZ Elements");
5233 b_constr.data = NULL;
5234 long* b_vals = (*_env)->GetLongArrayElements (_env, b, NULL);
5235 for (size_t h = 0; h < b_constr.datalen; h++) {
5236 long arr_conv_7 = b_vals[h];
5237 LDKTxOut arr_conv_7_conv = *(LDKTxOut*)arr_conv_7;
5238 FREE((void*)arr_conv_7);
5239 b_constr.data[h] = arr_conv_7_conv;
5241 (*_env)->ReleaseLongArrayElements (_env, b, b_vals, 0);
5242 LDKC2Tuple_TxidCVec_TxOutZZ* ret = MALLOC(sizeof(LDKC2Tuple_TxidCVec_TxOutZZ), "LDKC2Tuple_TxidCVec_TxOutZZ");
5243 *ret = C2Tuple_TxidCVec_TxOutZZ_new(a_ref, b_constr);
5247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
5248 LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
5249 *ret = C2Tuple_u64u64Z_new(a, b);
5253 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jbyteArray a, jobjectArray b) {
5255 CHECK((*_env)->GetArrayLength (_env, a) == 64);
5256 (*_env)->GetByteArrayRegion (_env, a, 0, 64, a_ref.compact_form);
5257 LDKCVec_SignatureZ b_constr;
5258 b_constr.datalen = (*_env)->GetArrayLength (_env, b);
5259 if (b_constr.datalen > 0)
5260 b_constr.data = MALLOC(b_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
5262 b_constr.data = NULL;
5263 for (size_t i = 0; i < b_constr.datalen; i++) {
5264 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, b, i);
5265 LDKSignature arr_conv_8_ref;
5266 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
5267 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
5268 b_constr.data[i] = arr_conv_8_ref;
5270 LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
5271 *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_ref, b_constr);
5275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
5276 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
5277 *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
5281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
5282 LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
5283 *ret = CResult_SignatureNoneZ_err();
5287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
5288 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
5289 *ret = CResult_CVec_SignatureZNoneZ_err();
5293 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
5294 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
5295 *ret = CResult_NoneAPIErrorZ_ok();
5299 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
5300 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
5301 *ret = CResult_NonePaymentSendFailureZ_ok();
5305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
5306 LDKChannelAnnouncement a_conv;
5307 a_conv.inner = (void*)(a & (~1));
5308 a_conv.is_owned = (a & 1) || (a == 0);
5309 if (a_conv.inner != NULL)
5310 a_conv = ChannelAnnouncement_clone(&a_conv);
5311 LDKChannelUpdate b_conv;
5312 b_conv.inner = (void*)(b & (~1));
5313 b_conv.is_owned = (b & 1) || (b == 0);
5314 if (b_conv.inner != NULL)
5315 b_conv = ChannelUpdate_clone(&b_conv);
5316 LDKChannelUpdate c_conv;
5317 c_conv.inner = (void*)(c & (~1));
5318 c_conv.is_owned = (c & 1) || (c == 0);
5319 if (c_conv.inner != NULL)
5320 c_conv = ChannelUpdate_clone(&c_conv);
5321 LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
5322 *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
5326 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
5327 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5328 *ret = CResult_NonePeerHandleErrorZ_ok();
5332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jbyteArray b) {
5333 LDKHTLCOutputInCommitment a_conv;
5334 a_conv.inner = (void*)(a & (~1));
5335 a_conv.is_owned = (a & 1) || (a == 0);
5336 if (a_conv.inner != NULL)
5337 a_conv = HTLCOutputInCommitment_clone(&a_conv);
5339 CHECK((*_env)->GetArrayLength (_env, b) == 64);
5340 (*_env)->GetByteArrayRegion (_env, b, 0, 64, b_ref.compact_form);
5341 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
5342 *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_ref);
5346 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5347 LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
5348 FREE((void*)this_ptr);
5349 Event_free(this_ptr_conv);
5352 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5353 LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
5354 FREE((void*)this_ptr);
5355 MessageSendEvent_free(this_ptr_conv);
5358 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5359 LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
5360 FREE((void*)this_ptr);
5361 MessageSendEventsProvider_free(this_ptr_conv);
5364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5365 LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
5366 FREE((void*)this_ptr);
5367 EventsProvider_free(this_ptr_conv);
5370 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5371 LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
5372 FREE((void*)this_ptr);
5373 APIError_free(this_ptr_conv);
5376 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
5377 jclass ret = LDKLevel_to_java(_env, Level_max());
5381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5382 LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
5383 FREE((void*)this_ptr);
5384 Logger_free(this_ptr_conv);
5387 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5388 LDKChannelHandshakeConfig this_ptr_conv;
5389 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5390 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5391 ChannelHandshakeConfig_free(this_ptr_conv);
5394 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5395 LDKChannelHandshakeConfig orig_conv;
5396 orig_conv.inner = (void*)(orig & (~1));
5397 orig_conv.is_owned = (orig & 1) || (orig == 0);
5398 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_clone(&orig_conv);
5399 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5402 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5403 LDKChannelHandshakeConfig this_ptr_conv;
5404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5406 jint ret_val = ChannelHandshakeConfig_get_minimum_depth(&this_ptr_conv);
5410 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5411 LDKChannelHandshakeConfig this_ptr_conv;
5412 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5413 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5414 ChannelHandshakeConfig_set_minimum_depth(&this_ptr_conv, val);
5417 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5418 LDKChannelHandshakeConfig this_ptr_conv;
5419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5421 jshort ret_val = ChannelHandshakeConfig_get_our_to_self_delay(&this_ptr_conv);
5425 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5426 LDKChannelHandshakeConfig this_ptr_conv;
5427 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5428 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5429 ChannelHandshakeConfig_set_our_to_self_delay(&this_ptr_conv, val);
5432 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5433 LDKChannelHandshakeConfig this_ptr_conv;
5434 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5435 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5436 jlong ret_val = ChannelHandshakeConfig_get_our_htlc_minimum_msat(&this_ptr_conv);
5440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5441 LDKChannelHandshakeConfig this_ptr_conv;
5442 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5443 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5444 ChannelHandshakeConfig_set_our_htlc_minimum_msat(&this_ptr_conv, val);
5447 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) {
5448 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
5449 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
5453 LDKChannelHandshakeConfig ret = ChannelHandshakeConfig_default();
5454 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5457 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5458 LDKChannelHandshakeLimits this_ptr_conv;
5459 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5460 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5461 ChannelHandshakeLimits_free(this_ptr_conv);
5464 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5465 LDKChannelHandshakeLimits orig_conv;
5466 orig_conv.inner = (void*)(orig & (~1));
5467 orig_conv.is_owned = (orig & 1) || (orig == 0);
5468 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_clone(&orig_conv);
5469 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5472 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5473 LDKChannelHandshakeLimits this_ptr_conv;
5474 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5475 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5476 jlong ret_val = ChannelHandshakeLimits_get_min_funding_satoshis(&this_ptr_conv);
5480 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5481 LDKChannelHandshakeLimits this_ptr_conv;
5482 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5483 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5484 ChannelHandshakeLimits_set_min_funding_satoshis(&this_ptr_conv, val);
5487 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5488 LDKChannelHandshakeLimits this_ptr_conv;
5489 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5490 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5491 jlong ret_val = ChannelHandshakeLimits_get_max_htlc_minimum_msat(&this_ptr_conv);
5495 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5496 LDKChannelHandshakeLimits this_ptr_conv;
5497 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5498 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5499 ChannelHandshakeLimits_set_max_htlc_minimum_msat(&this_ptr_conv, val);
5502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
5503 LDKChannelHandshakeLimits 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 jlong ret_val = ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(&this_ptr_conv);
5510 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) {
5511 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
5517 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5518 LDKChannelHandshakeLimits this_ptr_conv;
5519 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5520 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5521 jlong ret_val = ChannelHandshakeLimits_get_max_channel_reserve_satoshis(&this_ptr_conv);
5525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5526 LDKChannelHandshakeLimits this_ptr_conv;
5527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5529 ChannelHandshakeLimits_set_max_channel_reserve_satoshis(&this_ptr_conv, val);
5532 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
5533 LDKChannelHandshakeLimits this_ptr_conv;
5534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5536 jshort ret_val = ChannelHandshakeLimits_get_min_max_accepted_htlcs(&this_ptr_conv);
5540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5541 LDKChannelHandshakeLimits this_ptr_conv;
5542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5544 ChannelHandshakeLimits_set_min_max_accepted_htlcs(&this_ptr_conv, val);
5547 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5548 LDKChannelHandshakeLimits this_ptr_conv;
5549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5551 jlong ret_val = ChannelHandshakeLimits_get_min_dust_limit_satoshis(&this_ptr_conv);
5555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5556 LDKChannelHandshakeLimits this_ptr_conv;
5557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5559 ChannelHandshakeLimits_set_min_dust_limit_satoshis(&this_ptr_conv, val);
5562 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
5563 LDKChannelHandshakeLimits this_ptr_conv;
5564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5566 jlong ret_val = ChannelHandshakeLimits_get_max_dust_limit_satoshis(&this_ptr_conv);
5570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5571 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_max_dust_limit_satoshis(&this_ptr_conv, val);
5577 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
5578 LDKChannelHandshakeLimits this_ptr_conv;
5579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5581 jint ret_val = ChannelHandshakeLimits_get_max_minimum_depth(&this_ptr_conv);
5585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5586 LDKChannelHandshakeLimits 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 ChannelHandshakeLimits_set_max_minimum_depth(&this_ptr_conv, val);
5592 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
5593 LDKChannelHandshakeLimits this_ptr_conv;
5594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5596 jboolean ret_val = ChannelHandshakeLimits_get_force_announced_channel_preference(&this_ptr_conv);
5600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5601 LDKChannelHandshakeLimits this_ptr_conv;
5602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5604 ChannelHandshakeLimits_set_force_announced_channel_preference(&this_ptr_conv, val);
5607 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
5608 LDKChannelHandshakeLimits this_ptr_conv;
5609 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5610 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5611 jshort ret_val = ChannelHandshakeLimits_get_their_to_self_delay(&this_ptr_conv);
5615 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
5616 LDKChannelHandshakeLimits this_ptr_conv;
5617 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5618 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5619 ChannelHandshakeLimits_set_their_to_self_delay(&this_ptr_conv, val);
5622 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) {
5623 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);
5624 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5627 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
5628 LDKChannelHandshakeLimits ret = ChannelHandshakeLimits_default();
5629 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5632 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5633 LDKChannelConfig 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 ChannelConfig_free(this_ptr_conv);
5639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5640 LDKChannelConfig orig_conv;
5641 orig_conv.inner = (void*)(orig & (~1));
5642 orig_conv.is_owned = (orig & 1) || (orig == 0);
5643 LDKChannelConfig ret = ChannelConfig_clone(&orig_conv);
5644 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5647 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
5648 LDKChannelConfig this_ptr_conv;
5649 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5650 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5651 jint ret_val = ChannelConfig_get_fee_proportional_millionths(&this_ptr_conv);
5655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
5656 LDKChannelConfig this_ptr_conv;
5657 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5658 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5659 ChannelConfig_set_fee_proportional_millionths(&this_ptr_conv, val);
5662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
5663 LDKChannelConfig this_ptr_conv;
5664 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5665 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5666 jboolean ret_val = ChannelConfig_get_announced_channel(&this_ptr_conv);
5670 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5671 LDKChannelConfig 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 ChannelConfig_set_announced_channel(&this_ptr_conv, val);
5677 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5678 LDKChannelConfig this_ptr_conv;
5679 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5680 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5681 jboolean ret_val = ChannelConfig_get_commit_upfront_shutdown_pubkey(&this_ptr_conv);
5685 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5686 LDKChannelConfig this_ptr_conv;
5687 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5688 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5689 ChannelConfig_set_commit_upfront_shutdown_pubkey(&this_ptr_conv, val);
5692 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) {
5693 LDKChannelConfig ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
5694 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5697 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
5698 LDKChannelConfig ret = ChannelConfig_default();
5699 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5702 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
5703 LDKChannelConfig obj_conv;
5704 obj_conv.inner = (void*)(obj & (~1));
5705 obj_conv.is_owned = (obj & 1) || (obj == 0);
5706 LDKCVec_u8Z arg_var = ChannelConfig_write(&obj_conv);
5707 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5708 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5714 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5715 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5716 LDKChannelConfig ret = ChannelConfig_read(ser_ref);
5717 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5718 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5721 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5722 LDKUserConfig this_ptr_conv;
5723 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5724 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5725 UserConfig_free(this_ptr_conv);
5728 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5729 LDKUserConfig orig_conv;
5730 orig_conv.inner = (void*)(orig & (~1));
5731 orig_conv.is_owned = (orig & 1) || (orig == 0);
5732 LDKUserConfig ret = UserConfig_clone(&orig_conv);
5733 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5736 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
5737 LDKUserConfig this_ptr_conv;
5738 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5739 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5740 LDKChannelHandshakeConfig ret = UserConfig_get_own_channel_config(&this_ptr_conv);
5741 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5744 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5745 LDKUserConfig this_ptr_conv;
5746 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5747 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5748 LDKChannelHandshakeConfig val_conv;
5749 val_conv.inner = (void*)(val & (~1));
5750 val_conv.is_owned = (val & 1) || (val == 0);
5751 if (val_conv.inner != NULL)
5752 val_conv = ChannelHandshakeConfig_clone(&val_conv);
5753 UserConfig_set_own_channel_config(&this_ptr_conv, val_conv);
5756 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
5757 LDKUserConfig this_ptr_conv;
5758 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5759 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5760 LDKChannelHandshakeLimits ret = UserConfig_get_peer_channel_config_limits(&this_ptr_conv);
5761 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5765 LDKUserConfig this_ptr_conv;
5766 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5767 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5768 LDKChannelHandshakeLimits val_conv;
5769 val_conv.inner = (void*)(val & (~1));
5770 val_conv.is_owned = (val & 1) || (val == 0);
5771 if (val_conv.inner != NULL)
5772 val_conv = ChannelHandshakeLimits_clone(&val_conv);
5773 UserConfig_set_peer_channel_config_limits(&this_ptr_conv, val_conv);
5776 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
5777 LDKUserConfig this_ptr_conv;
5778 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5779 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5780 LDKChannelConfig ret = UserConfig_get_channel_options(&this_ptr_conv);
5781 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5785 LDKUserConfig this_ptr_conv;
5786 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5787 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5788 LDKChannelConfig val_conv;
5789 val_conv.inner = (void*)(val & (~1));
5790 val_conv.is_owned = (val & 1) || (val == 0);
5791 if (val_conv.inner != NULL)
5792 val_conv = ChannelConfig_clone(&val_conv);
5793 UserConfig_set_channel_options(&this_ptr_conv, val_conv);
5796 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) {
5797 LDKChannelHandshakeConfig own_channel_config_arg_conv;
5798 own_channel_config_arg_conv.inner = (void*)(own_channel_config_arg & (~1));
5799 own_channel_config_arg_conv.is_owned = (own_channel_config_arg & 1) || (own_channel_config_arg == 0);
5800 if (own_channel_config_arg_conv.inner != NULL)
5801 own_channel_config_arg_conv = ChannelHandshakeConfig_clone(&own_channel_config_arg_conv);
5802 LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv;
5803 peer_channel_config_limits_arg_conv.inner = (void*)(peer_channel_config_limits_arg & (~1));
5804 peer_channel_config_limits_arg_conv.is_owned = (peer_channel_config_limits_arg & 1) || (peer_channel_config_limits_arg == 0);
5805 if (peer_channel_config_limits_arg_conv.inner != NULL)
5806 peer_channel_config_limits_arg_conv = ChannelHandshakeLimits_clone(&peer_channel_config_limits_arg_conv);
5807 LDKChannelConfig channel_options_arg_conv;
5808 channel_options_arg_conv.inner = (void*)(channel_options_arg & (~1));
5809 channel_options_arg_conv.is_owned = (channel_options_arg & 1) || (channel_options_arg == 0);
5810 if (channel_options_arg_conv.inner != NULL)
5811 channel_options_arg_conv = ChannelConfig_clone(&channel_options_arg_conv);
5812 LDKUserConfig ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
5813 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
5817 LDKUserConfig ret = UserConfig_default();
5818 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Access_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5822 LDKAccess this_ptr_conv = *(LDKAccess*)this_ptr;
5823 FREE((void*)this_ptr);
5824 Access_free(this_ptr_conv);
5827 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Watch_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5828 LDKWatch this_ptr_conv = *(LDKWatch*)this_ptr;
5829 FREE((void*)this_ptr);
5830 Watch_free(this_ptr_conv);
5833 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Filter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5834 LDKFilter this_ptr_conv = *(LDKFilter*)this_ptr;
5835 FREE((void*)this_ptr);
5836 Filter_free(this_ptr_conv);
5839 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5840 LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
5841 FREE((void*)this_ptr);
5842 BroadcasterInterface_free(this_ptr_conv);
5845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5846 LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
5847 FREE((void*)this_ptr);
5848 FeeEstimator_free(this_ptr_conv);
5851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5852 LDKChainMonitor this_ptr_conv;
5853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5855 ChainMonitor_free(this_ptr_conv);
5858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
5859 LDKChainMonitor this_arg_conv;
5860 this_arg_conv.inner = (void*)(this_arg & (~1));
5861 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5862 unsigned char header_arr[80];
5863 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5864 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5865 unsigned char (*header_ref)[80] = &header_arr;
5866 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
5867 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
5868 if (txdata_constr.datalen > 0)
5869 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
5871 txdata_constr.data = NULL;
5872 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
5873 for (size_t d = 0; d < txdata_constr.datalen; d++) {
5874 long arr_conv_29 = txdata_vals[d];
5875 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
5876 FREE((void*)arr_conv_29);
5877 txdata_constr.data[d] = arr_conv_29_conv;
5879 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
5880 ChainMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
5883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
5884 LDKChainMonitor this_arg_conv;
5885 this_arg_conv.inner = (void*)(this_arg & (~1));
5886 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5887 unsigned char header_arr[80];
5888 CHECK((*_env)->GetArrayLength (_env, header) == 80);
5889 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
5890 unsigned char (*header_ref)[80] = &header_arr;
5891 ChainMonitor_block_disconnected(&this_arg_conv, header_ref, disconnected_height);
5894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1new(JNIEnv * _env, jclass _b, jlong chain_source, jlong broadcaster, jlong logger, jlong feeest) {
5895 LDKFilter* chain_source_conv = (LDKFilter*)chain_source;
5896 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
5897 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
5898 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5899 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
5901 LDKLogger logger_conv = *(LDKLogger*)logger;
5902 if (logger_conv.free == LDKLogger_JCalls_free) {
5903 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5904 LDKLogger_JCalls_clone(logger_conv.this_arg);
5906 LDKFeeEstimator feeest_conv = *(LDKFeeEstimator*)feeest;
5907 if (feeest_conv.free == LDKFeeEstimator_JCalls_free) {
5908 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
5909 LDKFeeEstimator_JCalls_clone(feeest_conv.this_arg);
5911 LDKChainMonitor ret = ChainMonitor_new(chain_source_conv, broadcaster_conv, logger_conv, feeest_conv);
5912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5915 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1Watch(JNIEnv * _env, jclass _b, jlong this_arg) {
5916 LDKChainMonitor this_arg_conv;
5917 this_arg_conv.inner = (void*)(this_arg & (~1));
5918 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5919 LDKWatch* ret = MALLOC(sizeof(LDKWatch), "LDKWatch");
5920 *ret = ChainMonitor_as_Watch(&this_arg_conv);
5924 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainMonitor_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
5925 LDKChainMonitor this_arg_conv;
5926 this_arg_conv.inner = (void*)(this_arg & (~1));
5927 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
5928 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
5929 *ret = ChainMonitor_as_EventsProvider(&this_arg_conv);
5933 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5934 LDKChannelMonitorUpdate 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 ChannelMonitorUpdate_free(this_ptr_conv);
5940 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
5941 LDKChannelMonitorUpdate orig_conv;
5942 orig_conv.inner = (void*)(orig & (~1));
5943 orig_conv.is_owned = (orig & 1) || (orig == 0);
5944 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_clone(&orig_conv);
5945 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5948 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
5949 LDKChannelMonitorUpdate 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 jlong ret_val = ChannelMonitorUpdate_get_update_id(&this_ptr_conv);
5956 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5957 LDKChannelMonitorUpdate 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 ChannelMonitorUpdate_set_update_id(&this_ptr_conv, val);
5963 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5964 LDKChannelMonitorUpdate obj_conv;
5965 obj_conv.inner = (void*)(obj & (~1));
5966 obj_conv.is_owned = (obj & 1) || (obj == 0);
5967 LDKCVec_u8Z arg_var = ChannelMonitorUpdate_write(&obj_conv);
5968 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
5969 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
5973 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
5975 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
5976 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
5977 LDKChannelMonitorUpdate ret = ChannelMonitorUpdate_read(ser_ref);
5978 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
5979 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
5982 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5983 LDKMonitorUpdateError this_ptr_conv;
5984 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5985 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5986 MonitorUpdateError_free(this_ptr_conv);
5989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5990 LDKMonitorEvent this_ptr_conv;
5991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
5993 MonitorEvent_free(this_ptr_conv);
5996 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5997 LDKHTLCUpdate this_ptr_conv;
5998 this_ptr_conv.inner = (void*)(this_ptr & (~1));
5999 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6000 HTLCUpdate_free(this_ptr_conv);
6003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6004 LDKHTLCUpdate orig_conv;
6005 orig_conv.inner = (void*)(orig & (~1));
6006 orig_conv.is_owned = (orig & 1) || (orig == 0);
6007 LDKHTLCUpdate ret = HTLCUpdate_clone(&orig_conv);
6008 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6011 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
6012 LDKHTLCUpdate obj_conv;
6013 obj_conv.inner = (void*)(obj & (~1));
6014 obj_conv.is_owned = (obj & 1) || (obj == 0);
6015 LDKCVec_u8Z arg_var = HTLCUpdate_write(&obj_conv);
6016 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6017 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6021 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6023 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6024 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6025 LDKHTLCUpdate ret = HTLCUpdate_read(ser_ref);
6026 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6027 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6030 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6031 LDKChannelMonitor this_ptr_conv;
6032 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6033 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6034 ChannelMonitor_free(this_ptr_conv);
6037 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
6038 LDKChannelMonitor this_arg_conv;
6039 this_arg_conv.inner = (void*)(this_arg & (~1));
6040 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6041 LDKChannelMonitorUpdate updates_conv;
6042 updates_conv.inner = (void*)(updates & (~1));
6043 updates_conv.is_owned = (updates & 1) || (updates == 0);
6044 if (updates_conv.inner != NULL)
6045 updates_conv = ChannelMonitorUpdate_clone(&updates_conv);
6046 LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
6047 LDKLogger* logger_conv = (LDKLogger*)logger;
6048 LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
6049 *ret = ChannelMonitor_update_monitor(&this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
6053 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6054 LDKChannelMonitor this_arg_conv;
6055 this_arg_conv.inner = (void*)(this_arg & (~1));
6056 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6057 jlong ret_val = ChannelMonitor_get_latest_update_id(&this_arg_conv);
6061 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
6062 LDKChannelMonitor this_arg_conv;
6063 this_arg_conv.inner = (void*)(this_arg & (~1));
6064 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6065 LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
6066 *ret = ChannelMonitor_get_funding_txo(&this_arg_conv);
6070 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6071 LDKChannelMonitor this_arg_conv;
6072 this_arg_conv.inner = (void*)(this_arg & (~1));
6073 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6074 LDKCVec_MonitorEventZ ret_var = ChannelMonitor_get_and_clear_pending_monitor_events(&this_arg_conv);
6075 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6076 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6077 for (size_t o = 0; o < ret_var.datalen; o++) {
6078 LDKMonitorEvent arr_conv_14_var = ret_var.data[o];
6079 CHECK((((long)arr_conv_14_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6080 CHECK((((long)&arr_conv_14_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6081 long arr_conv_14_ref;
6082 if (arr_conv_14_var.is_owned) {
6083 arr_conv_14_ref = (long)arr_conv_14_var.inner | 1;
6085 arr_conv_14_ref = (long)&arr_conv_14_var;
6087 ret_arr_ptr[o] = arr_conv_14_ref;
6089 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6094 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
6095 LDKChannelMonitor this_arg_conv;
6096 this_arg_conv.inner = (void*)(this_arg & (~1));
6097 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6098 LDKCVec_EventZ ret_var = ChannelMonitor_get_and_clear_pending_events(&this_arg_conv);
6099 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6100 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6101 for (size_t h = 0; h < ret_var.datalen; h++) {
6102 long arr_conv_7_ref = (long)&ret_var.data[h];
6103 ret_arr_ptr[h] = arr_conv_7_ref;
6105 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6109 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1holder_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
6110 LDKChannelMonitor this_arg_conv;
6111 this_arg_conv.inner = (void*)(this_arg & (~1));
6112 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6113 LDKLogger* logger_conv = (LDKLogger*)logger;
6114 LDKCVec_TransactionZ ret_var = ChannelMonitor_get_latest_holder_commitment_txn(&this_arg_conv, logger_conv);
6115 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6116 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6117 for (size_t n = 0; n < ret_var.datalen; n++) {
6118 long arr_conv_13_ref = (long)&ret_var.data[n];
6119 ret_arr_ptr[n] = arr_conv_13_ref;
6121 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6125 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height, jlong broadcaster, jlong fee_estimator, jlong logger) {
6126 LDKChannelMonitor this_arg_conv;
6127 this_arg_conv.inner = (void*)(this_arg & (~1));
6128 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6129 unsigned char header_arr[80];
6130 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6131 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6132 unsigned char (*header_ref)[80] = &header_arr;
6133 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6134 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6135 if (txdata_constr.datalen > 0)
6136 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6138 txdata_constr.data = NULL;
6139 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6140 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6141 long arr_conv_29 = txdata_vals[d];
6142 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6143 FREE((void*)arr_conv_29);
6144 txdata_constr.data[d] = arr_conv_29_conv;
6146 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6147 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6148 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6149 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6150 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6152 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6153 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6154 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6155 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6157 LDKLogger logger_conv = *(LDKLogger*)logger;
6158 if (logger_conv.free == LDKLogger_JCalls_free) {
6159 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6160 LDKLogger_JCalls_clone(logger_conv.this_arg);
6162 LDKCVec_C2Tuple_TxidCVec_TxOutZZZ ret_var = ChannelMonitor_block_connected(&this_arg_conv, header_ref, txdata_constr, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6163 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6164 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6165 for (size_t b = 0; b < ret_var.datalen; b++) {
6166 long arr_conv_27_ref = (long)&ret_var.data[b];
6167 ret_arr_ptr[b] = arr_conv_27_ref;
6169 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6173 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) {
6174 LDKChannelMonitor 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 unsigned char header_arr[80];
6178 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6179 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6180 unsigned char (*header_ref)[80] = &header_arr;
6181 LDKBroadcasterInterface broadcaster_conv = *(LDKBroadcasterInterface*)broadcaster;
6182 if (broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6183 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6184 LDKBroadcasterInterface_JCalls_clone(broadcaster_conv.this_arg);
6186 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
6187 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
6188 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6189 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
6191 LDKLogger logger_conv = *(LDKLogger*)logger;
6192 if (logger_conv.free == LDKLogger_JCalls_free) {
6193 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6194 LDKLogger_JCalls_clone(logger_conv.this_arg);
6196 ChannelMonitor_block_disconnected(&this_arg_conv, header_ref, height, broadcaster_conv, fee_estimator_conv, logger_conv);
6199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6200 LDKOutPoint this_ptr_conv;
6201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6203 OutPoint_free(this_ptr_conv);
6206 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6207 LDKOutPoint orig_conv;
6208 orig_conv.inner = (void*)(orig & (~1));
6209 orig_conv.is_owned = (orig & 1) || (orig == 0);
6210 LDKOutPoint ret = OutPoint_clone(&orig_conv);
6211 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6214 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
6215 LDKOutPoint this_ptr_conv;
6216 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6217 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6218 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6219 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(&this_ptr_conv));
6223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6224 LDKOutPoint this_ptr_conv;
6225 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6226 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6227 LDKThirtyTwoBytes val_ref;
6228 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6229 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6230 OutPoint_set_txid(&this_ptr_conv, val_ref);
6233 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
6234 LDKOutPoint this_ptr_conv;
6235 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6236 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6237 jshort ret_val = OutPoint_get_index(&this_ptr_conv);
6241 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6242 LDKOutPoint 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 OutPoint_set_index(&this_ptr_conv, val);
6248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jbyteArray txid_arg, jshort index_arg) {
6249 LDKThirtyTwoBytes txid_arg_ref;
6250 CHECK((*_env)->GetArrayLength (_env, txid_arg) == 32);
6251 (*_env)->GetByteArrayRegion (_env, txid_arg, 0, 32, txid_arg_ref.data);
6252 LDKOutPoint ret = OutPoint_new(txid_arg_ref, index_arg);
6253 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6256 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6257 LDKOutPoint this_arg_conv;
6258 this_arg_conv.inner = (void*)(this_arg & (~1));
6259 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6260 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
6261 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, OutPoint_to_channel_id(&this_arg_conv).data);
6265 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
6266 LDKOutPoint obj_conv;
6267 obj_conv.inner = (void*)(obj & (~1));
6268 obj_conv.is_owned = (obj & 1) || (obj == 0);
6269 LDKCVec_u8Z arg_var = OutPoint_write(&obj_conv);
6270 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6271 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6275 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6277 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6278 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6279 LDKOutPoint ret = OutPoint_read(ser_ref);
6280 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6281 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6285 LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
6286 FREE((void*)this_ptr);
6287 SpendableOutputDescriptor_free(this_ptr_conv);
6290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6291 LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
6292 FREE((void*)this_ptr);
6293 ChannelKeys_free(this_ptr_conv);
6296 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6297 LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
6298 FREE((void*)this_ptr);
6299 KeysInterface_free(this_ptr_conv);
6302 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6303 LDKInMemoryChannelKeys this_ptr_conv;
6304 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6305 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6306 InMemoryChannelKeys_free(this_ptr_conv);
6309 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6310 LDKInMemoryChannelKeys orig_conv;
6311 orig_conv.inner = (void*)(orig & (~1));
6312 orig_conv.is_owned = (orig & 1) || (orig == 0);
6313 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_clone(&orig_conv);
6314 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6317 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6318 LDKInMemoryChannelKeys this_ptr_conv;
6319 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6320 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6321 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6322 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(&this_ptr_conv));
6326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6327 LDKInMemoryChannelKeys this_ptr_conv;
6328 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6329 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6330 LDKSecretKey val_ref;
6331 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6332 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6333 InMemoryChannelKeys_set_funding_key(&this_ptr_conv, val_ref);
6336 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6337 LDKInMemoryChannelKeys this_ptr_conv;
6338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6340 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6341 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(&this_ptr_conv));
6345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6346 LDKInMemoryChannelKeys this_ptr_conv;
6347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6349 LDKSecretKey val_ref;
6350 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6351 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6352 InMemoryChannelKeys_set_revocation_base_key(&this_ptr_conv, val_ref);
6355 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6356 LDKInMemoryChannelKeys this_ptr_conv;
6357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6359 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6360 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(&this_ptr_conv));
6364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6365 LDKInMemoryChannelKeys this_ptr_conv;
6366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6368 LDKSecretKey val_ref;
6369 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6370 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6371 InMemoryChannelKeys_set_payment_key(&this_ptr_conv, val_ref);
6374 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6375 LDKInMemoryChannelKeys this_ptr_conv;
6376 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6377 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6378 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6379 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(&this_ptr_conv));
6383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6384 LDKInMemoryChannelKeys this_ptr_conv;
6385 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6386 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6387 LDKSecretKey val_ref;
6388 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6389 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6390 InMemoryChannelKeys_set_delayed_payment_base_key(&this_ptr_conv, val_ref);
6393 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
6394 LDKInMemoryChannelKeys this_ptr_conv;
6395 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6396 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6397 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6398 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(&this_ptr_conv));
6402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6403 LDKInMemoryChannelKeys this_ptr_conv;
6404 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6405 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6406 LDKSecretKey val_ref;
6407 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6408 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.bytes);
6409 InMemoryChannelKeys_set_htlc_base_key(&this_ptr_conv, val_ref);
6412 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
6413 LDKInMemoryChannelKeys this_ptr_conv;
6414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6416 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6417 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(&this_ptr_conv));
6421 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6422 LDKInMemoryChannelKeys this_ptr_conv;
6423 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6424 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6425 LDKThirtyTwoBytes val_ref;
6426 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6427 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6428 InMemoryChannelKeys_set_commitment_seed(&this_ptr_conv, val_ref);
6431 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) {
6432 LDKSecretKey funding_key_ref;
6433 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
6434 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_ref.bytes);
6435 LDKSecretKey revocation_base_key_ref;
6436 CHECK((*_env)->GetArrayLength (_env, revocation_base_key) == 32);
6437 (*_env)->GetByteArrayRegion (_env, revocation_base_key, 0, 32, revocation_base_key_ref.bytes);
6438 LDKSecretKey payment_key_ref;
6439 CHECK((*_env)->GetArrayLength (_env, payment_key) == 32);
6440 (*_env)->GetByteArrayRegion (_env, payment_key, 0, 32, payment_key_ref.bytes);
6441 LDKSecretKey delayed_payment_base_key_ref;
6442 CHECK((*_env)->GetArrayLength (_env, delayed_payment_base_key) == 32);
6443 (*_env)->GetByteArrayRegion (_env, delayed_payment_base_key, 0, 32, delayed_payment_base_key_ref.bytes);
6444 LDKSecretKey htlc_base_key_ref;
6445 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
6446 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_ref.bytes);
6447 LDKThirtyTwoBytes commitment_seed_ref;
6448 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
6449 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_ref.data);
6450 LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
6451 FREE((void*)key_derivation_params);
6452 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);
6453 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6457 LDKInMemoryChannelKeys this_arg_conv;
6458 this_arg_conv.inner = (void*)(this_arg & (~1));
6459 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6460 LDKChannelPublicKeys ret = InMemoryChannelKeys_counterparty_pubkeys(&this_arg_conv);
6461 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6464 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1counterparty_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6465 LDKInMemoryChannelKeys this_arg_conv;
6466 this_arg_conv.inner = (void*)(this_arg & (~1));
6467 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6468 jshort ret_val = InMemoryChannelKeys_counterparty_selected_contest_delay(&this_arg_conv);
6472 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1holder_1selected_1contest_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
6473 LDKInMemoryChannelKeys this_arg_conv;
6474 this_arg_conv.inner = (void*)(this_arg & (~1));
6475 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6476 jshort ret_val = InMemoryChannelKeys_holder_selected_contest_delay(&this_arg_conv);
6480 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
6481 LDKInMemoryChannelKeys this_arg_conv;
6482 this_arg_conv.inner = (void*)(this_arg & (~1));
6483 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6484 LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
6485 *ret = InMemoryChannelKeys_as_ChannelKeys(&this_arg_conv);
6489 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6490 LDKInMemoryChannelKeys obj_conv;
6491 obj_conv.inner = (void*)(obj & (~1));
6492 obj_conv.is_owned = (obj & 1) || (obj == 0);
6493 LDKCVec_u8Z arg_var = InMemoryChannelKeys_write(&obj_conv);
6494 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
6495 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
6499 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
6501 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
6502 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
6503 LDKInMemoryChannelKeys ret = InMemoryChannelKeys_read(ser_ref);
6504 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
6505 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6508 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6509 LDKKeysManager this_ptr_conv;
6510 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6511 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6512 KeysManager_free(this_ptr_conv);
6515 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) {
6516 unsigned char seed_arr[32];
6517 CHECK((*_env)->GetArrayLength (_env, seed) == 32);
6518 (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
6519 unsigned char (*seed_ref)[32] = &seed_arr;
6520 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6521 LDKKeysManager ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
6522 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6525 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) {
6526 LDKKeysManager this_arg_conv;
6527 this_arg_conv.inner = (void*)(this_arg & (~1));
6528 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6529 LDKInMemoryChannelKeys ret = KeysManager_derive_channel_keys(&this_arg_conv, channel_value_satoshis, params_1, params_2);
6530 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6533 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
6534 LDKKeysManager this_arg_conv;
6535 this_arg_conv.inner = (void*)(this_arg & (~1));
6536 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6537 LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
6538 *ret = KeysManager_as_KeysInterface(&this_arg_conv);
6542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6543 LDKChannelManager this_ptr_conv;
6544 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6545 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6546 ChannelManager_free(this_ptr_conv);
6549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6550 LDKChannelDetails this_ptr_conv;
6551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6553 ChannelDetails_free(this_ptr_conv);
6556 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1clone(JNIEnv * _env, jclass _b, jlong orig) {
6557 LDKChannelDetails orig_conv;
6558 orig_conv.inner = (void*)(orig & (~1));
6559 orig_conv.is_owned = (orig & 1) || (orig == 0);
6560 LDKChannelDetails ret = ChannelDetails_clone(&orig_conv);
6561 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6565 LDKChannelDetails this_ptr_conv;
6566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6568 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6569 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(&this_ptr_conv));
6573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6574 LDKChannelDetails this_ptr_conv;
6575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6577 LDKThirtyTwoBytes val_ref;
6578 CHECK((*_env)->GetArrayLength (_env, val) == 32);
6579 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
6580 ChannelDetails_set_channel_id(&this_ptr_conv, val_ref);
6583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6584 LDKChannelDetails this_ptr_conv;
6585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelDetails_get_remote_network_id(&this_ptr_conv).compressed_form);
6592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
6593 LDKChannelDetails this_ptr_conv;
6594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6596 LDKPublicKey val_ref;
6597 CHECK((*_env)->GetArrayLength (_env, val) == 33);
6598 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
6599 ChannelDetails_set_remote_network_id(&this_ptr_conv, val_ref);
6602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
6603 LDKChannelDetails this_ptr_conv;
6604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6606 LDKInitFeatures ret = ChannelDetails_get_counterparty_features(&this_ptr_conv);
6607 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6610 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6611 LDKChannelDetails 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 LDKInitFeatures val_conv;
6615 val_conv.inner = (void*)(val & (~1));
6616 val_conv.is_owned = (val & 1) || (val == 0);
6617 // Warning: we may need a move here but can't clone!
6618 ChannelDetails_set_counterparty_features(&this_ptr_conv, val_conv);
6621 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
6622 LDKChannelDetails this_ptr_conv;
6623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6625 jlong ret_val = ChannelDetails_get_channel_value_satoshis(&this_ptr_conv);
6629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6630 LDKChannelDetails this_ptr_conv;
6631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6633 ChannelDetails_set_channel_value_satoshis(&this_ptr_conv, val);
6636 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6637 LDKChannelDetails this_ptr_conv;
6638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6640 jlong ret_val = ChannelDetails_get_user_id(&this_ptr_conv);
6644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6645 LDKChannelDetails this_ptr_conv;
6646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6648 ChannelDetails_set_user_id(&this_ptr_conv, val);
6651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6652 LDKChannelDetails this_ptr_conv;
6653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6655 jlong ret_val = ChannelDetails_get_outbound_capacity_msat(&this_ptr_conv);
6659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6660 LDKChannelDetails this_ptr_conv;
6661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6663 ChannelDetails_set_outbound_capacity_msat(&this_ptr_conv, val);
6666 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6667 LDKChannelDetails this_ptr_conv;
6668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6670 jlong ret_val = ChannelDetails_get_inbound_capacity_msat(&this_ptr_conv);
6674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6675 LDKChannelDetails this_ptr_conv;
6676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6678 ChannelDetails_set_inbound_capacity_msat(&this_ptr_conv, val);
6681 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
6682 LDKChannelDetails this_ptr_conv;
6683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6685 jboolean ret_val = ChannelDetails_get_is_live(&this_ptr_conv);
6689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6690 LDKChannelDetails this_ptr_conv;
6691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6693 ChannelDetails_set_is_live(&this_ptr_conv, val);
6696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6697 LDKPaymentSendFailure this_ptr_conv;
6698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
6699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
6700 PaymentSendFailure_free(this_ptr_conv);
6703 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) {
6704 LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
6705 LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
6706 if (fee_est_conv.free == LDKFeeEstimator_JCalls_free) {
6707 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6708 LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
6710 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
6711 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
6712 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6713 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
6715 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
6716 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
6717 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6718 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
6720 LDKLogger logger_conv = *(LDKLogger*)logger;
6721 if (logger_conv.free == LDKLogger_JCalls_free) {
6722 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6723 LDKLogger_JCalls_clone(logger_conv.this_arg);
6725 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
6726 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
6727 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
6728 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
6730 LDKUserConfig config_conv;
6731 config_conv.inner = (void*)(config & (~1));
6732 config_conv.is_owned = (config & 1) || (config == 0);
6733 if (config_conv.inner != NULL)
6734 config_conv = UserConfig_clone(&config_conv);
6735 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);
6736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
6739 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) {
6740 LDKChannelManager this_arg_conv;
6741 this_arg_conv.inner = (void*)(this_arg & (~1));
6742 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6743 LDKPublicKey their_network_key_ref;
6744 CHECK((*_env)->GetArrayLength (_env, their_network_key) == 33);
6745 (*_env)->GetByteArrayRegion (_env, their_network_key, 0, 33, their_network_key_ref.compressed_form);
6746 LDKUserConfig override_config_conv;
6747 override_config_conv.inner = (void*)(override_config & (~1));
6748 override_config_conv.is_owned = (override_config & 1) || (override_config == 0);
6749 if (override_config_conv.inner != NULL)
6750 override_config_conv = UserConfig_clone(&override_config_conv);
6751 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6752 *ret = ChannelManager_create_channel(&this_arg_conv, their_network_key_ref, channel_value_satoshis, push_msat, user_id, override_config_conv);
6756 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6757 LDKChannelManager this_arg_conv;
6758 this_arg_conv.inner = (void*)(this_arg & (~1));
6759 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6760 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_channels(&this_arg_conv);
6761 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6762 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6763 for (size_t q = 0; q < ret_var.datalen; q++) {
6764 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6765 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6766 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6767 long arr_conv_16_ref;
6768 if (arr_conv_16_var.is_owned) {
6769 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6771 arr_conv_16_ref = (long)&arr_conv_16_var;
6773 ret_arr_ptr[q] = arr_conv_16_ref;
6775 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6780 JNIEXPORT jlongArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6781 LDKChannelManager this_arg_conv;
6782 this_arg_conv.inner = (void*)(this_arg & (~1));
6783 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6784 LDKCVec_ChannelDetailsZ ret_var = ChannelManager_list_usable_channels(&this_arg_conv);
6785 jlongArray ret_arr = (*_env)->NewLongArray(_env, ret_var.datalen);
6786 jlong *ret_arr_ptr = (*_env)->GetPrimitiveArrayCritical(_env, ret_arr, NULL);
6787 for (size_t q = 0; q < ret_var.datalen; q++) {
6788 LDKChannelDetails arr_conv_16_var = ret_var.data[q];
6789 CHECK((((long)arr_conv_16_var.inner) & 1) == 0); // We rely on a free low bit, malloc guarantees this.
6790 CHECK((((long)&arr_conv_16_var) & 1) == 0); // We rely on a free low bit, pointer alignment guarantees this.
6791 long arr_conv_16_ref;
6792 if (arr_conv_16_var.is_owned) {
6793 arr_conv_16_ref = (long)arr_conv_16_var.inner | 1;
6795 arr_conv_16_ref = (long)&arr_conv_16_var;
6797 ret_arr_ptr[q] = arr_conv_16_ref;
6799 (*_env)->ReleasePrimitiveArrayCritical(_env, ret_arr, ret_arr_ptr, 0);
6804 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6805 LDKChannelManager this_arg_conv;
6806 this_arg_conv.inner = (void*)(this_arg & (~1));
6807 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6808 unsigned char channel_id_arr[32];
6809 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6810 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6811 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6812 LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
6813 *ret = ChannelManager_close_channel(&this_arg_conv, channel_id_ref);
6817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
6818 LDKChannelManager this_arg_conv;
6819 this_arg_conv.inner = (void*)(this_arg & (~1));
6820 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6821 unsigned char channel_id_arr[32];
6822 CHECK((*_env)->GetArrayLength (_env, channel_id) == 32);
6823 (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
6824 unsigned char (*channel_id_ref)[32] = &channel_id_arr;
6825 ChannelManager_force_close_channel(&this_arg_conv, channel_id_ref);
6828 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
6829 LDKChannelManager this_arg_conv;
6830 this_arg_conv.inner = (void*)(this_arg & (~1));
6831 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6832 ChannelManager_force_close_all_channels(&this_arg_conv);
6835 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) {
6836 LDKChannelManager this_arg_conv;
6837 this_arg_conv.inner = (void*)(this_arg & (~1));
6838 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6839 LDKRoute route_conv;
6840 route_conv.inner = (void*)(route & (~1));
6841 route_conv.is_owned = (route & 1) || (route == 0);
6842 LDKThirtyTwoBytes payment_hash_ref;
6843 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6844 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_ref.data);
6845 LDKThirtyTwoBytes payment_secret_ref;
6846 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6847 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6848 LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
6849 *ret = ChannelManager_send_payment(&this_arg_conv, &route_conv, payment_hash_ref, payment_secret_ref);
6853 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) {
6854 LDKChannelManager this_arg_conv;
6855 this_arg_conv.inner = (void*)(this_arg & (~1));
6856 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6857 unsigned char temporary_channel_id_arr[32];
6858 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id) == 32);
6859 (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
6860 unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
6861 LDKOutPoint funding_txo_conv;
6862 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6863 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6864 if (funding_txo_conv.inner != NULL)
6865 funding_txo_conv = OutPoint_clone(&funding_txo_conv);
6866 ChannelManager_funding_transaction_generated(&this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
6869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray rgb, jbyteArray alias, jlongArray addresses) {
6870 LDKChannelManager this_arg_conv;
6871 this_arg_conv.inner = (void*)(this_arg & (~1));
6872 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6873 LDKThreeBytes rgb_ref;
6874 CHECK((*_env)->GetArrayLength (_env, rgb) == 3);
6875 (*_env)->GetByteArrayRegion (_env, rgb, 0, 3, rgb_ref.data);
6876 LDKThirtyTwoBytes alias_ref;
6877 CHECK((*_env)->GetArrayLength (_env, alias) == 32);
6878 (*_env)->GetByteArrayRegion (_env, alias, 0, 32, alias_ref.data);
6879 LDKCVec_NetAddressZ addresses_constr;
6880 addresses_constr.datalen = (*_env)->GetArrayLength (_env, addresses);
6881 if (addresses_constr.datalen > 0)
6882 addresses_constr.data = MALLOC(addresses_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
6884 addresses_constr.data = NULL;
6885 long* addresses_vals = (*_env)->GetLongArrayElements (_env, addresses, NULL);
6886 for (size_t m = 0; m < addresses_constr.datalen; m++) {
6887 long arr_conv_12 = addresses_vals[m];
6888 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
6889 FREE((void*)arr_conv_12);
6890 addresses_constr.data[m] = arr_conv_12_conv;
6892 (*_env)->ReleaseLongArrayElements (_env, addresses, addresses_vals, 0);
6893 ChannelManager_broadcast_node_announcement(&this_arg_conv, rgb_ref, alias_ref, addresses_constr);
6896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
6897 LDKChannelManager this_arg_conv;
6898 this_arg_conv.inner = (void*)(this_arg & (~1));
6899 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6900 ChannelManager_process_pending_htlc_forwards(&this_arg_conv);
6903 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
6904 LDKChannelManager this_arg_conv;
6905 this_arg_conv.inner = (void*)(this_arg & (~1));
6906 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6907 ChannelManager_timer_chan_freshness_every_min(&this_arg_conv);
6910 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) {
6911 LDKChannelManager this_arg_conv;
6912 this_arg_conv.inner = (void*)(this_arg & (~1));
6913 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6914 unsigned char payment_hash_arr[32];
6915 CHECK((*_env)->GetArrayLength (_env, payment_hash) == 32);
6916 (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
6917 unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
6918 LDKThirtyTwoBytes payment_secret_ref;
6919 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6920 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6921 jboolean ret_val = ChannelManager_fail_htlc_backwards(&this_arg_conv, payment_hash_ref, payment_secret_ref);
6925 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) {
6926 LDKChannelManager this_arg_conv;
6927 this_arg_conv.inner = (void*)(this_arg & (~1));
6928 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6929 LDKThirtyTwoBytes payment_preimage_ref;
6930 CHECK((*_env)->GetArrayLength (_env, payment_preimage) == 32);
6931 (*_env)->GetByteArrayRegion (_env, payment_preimage, 0, 32, payment_preimage_ref.data);
6932 LDKThirtyTwoBytes payment_secret_ref;
6933 CHECK((*_env)->GetArrayLength (_env, payment_secret) == 32);
6934 (*_env)->GetByteArrayRegion (_env, payment_secret, 0, 32, payment_secret_ref.data);
6935 jboolean ret_val = ChannelManager_claim_funds(&this_arg_conv, payment_preimage_ref, payment_secret_ref, expected_amount);
6939 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
6940 LDKChannelManager this_arg_conv;
6941 this_arg_conv.inner = (void*)(this_arg & (~1));
6942 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6943 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
6944 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelManager_get_our_node_id(&this_arg_conv).compressed_form);
6948 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) {
6949 LDKChannelManager this_arg_conv;
6950 this_arg_conv.inner = (void*)(this_arg & (~1));
6951 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6952 LDKOutPoint funding_txo_conv;
6953 funding_txo_conv.inner = (void*)(funding_txo & (~1));
6954 funding_txo_conv.is_owned = (funding_txo & 1) || (funding_txo == 0);
6955 ChannelManager_channel_monitor_updated(&this_arg_conv, &funding_txo_conv, highest_applied_update_id);
6958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6959 LDKChannelManager this_arg_conv;
6960 this_arg_conv.inner = (void*)(this_arg & (~1));
6961 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6962 LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
6963 *ret = ChannelManager_as_MessageSendEventsProvider(&this_arg_conv);
6967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
6968 LDKChannelManager this_arg_conv;
6969 this_arg_conv.inner = (void*)(this_arg & (~1));
6970 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6971 LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
6972 *ret = ChannelManager_as_EventsProvider(&this_arg_conv);
6976 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jlongArray txdata, jint height) {
6977 LDKChannelManager this_arg_conv;
6978 this_arg_conv.inner = (void*)(this_arg & (~1));
6979 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
6980 unsigned char header_arr[80];
6981 CHECK((*_env)->GetArrayLength (_env, header) == 80);
6982 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
6983 unsigned char (*header_ref)[80] = &header_arr;
6984 LDKCVec_C2Tuple_usizeTransactionZZ txdata_constr;
6985 txdata_constr.datalen = (*_env)->GetArrayLength (_env, txdata);
6986 if (txdata_constr.datalen > 0)
6987 txdata_constr.data = MALLOC(txdata_constr.datalen * sizeof(LDKC2Tuple_usizeTransactionZ), "LDKCVec_C2Tuple_usizeTransactionZZ Elements");
6989 txdata_constr.data = NULL;
6990 long* txdata_vals = (*_env)->GetLongArrayElements (_env, txdata, NULL);
6991 for (size_t d = 0; d < txdata_constr.datalen; d++) {
6992 long arr_conv_29 = txdata_vals[d];
6993 LDKC2Tuple_usizeTransactionZ arr_conv_29_conv = *(LDKC2Tuple_usizeTransactionZ*)arr_conv_29;
6994 FREE((void*)arr_conv_29);
6995 txdata_constr.data[d] = arr_conv_29_conv;
6997 (*_env)->ReleaseLongArrayElements (_env, txdata, txdata_vals, 0);
6998 ChannelManager_block_connected(&this_arg_conv, header_ref, txdata_constr, height);
7001 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header) {
7002 LDKChannelManager this_arg_conv;
7003 this_arg_conv.inner = (void*)(this_arg & (~1));
7004 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7005 unsigned char header_arr[80];
7006 CHECK((*_env)->GetArrayLength (_env, header) == 80);
7007 (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
7008 unsigned char (*header_ref)[80] = &header_arr;
7009 ChannelManager_block_disconnected(&this_arg_conv, header_ref);
7012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
7013 LDKChannelManager this_arg_conv;
7014 this_arg_conv.inner = (void*)(this_arg & (~1));
7015 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
7016 LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
7017 *ret = ChannelManager_as_ChannelMessageHandler(&this_arg_conv);
7021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7022 LDKChannelManagerReadArgs this_ptr_conv;
7023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7025 ChannelManagerReadArgs_free(this_ptr_conv);
7028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
7029 LDKChannelManagerReadArgs this_ptr_conv;
7030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7032 long ret = (long)ChannelManagerReadArgs_get_keys_manager(&this_ptr_conv);
7036 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7037 LDKChannelManagerReadArgs this_ptr_conv;
7038 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7039 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7040 LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
7041 if (val_conv.free == LDKKeysInterface_JCalls_free) {
7042 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7043 LDKKeysInterface_JCalls_clone(val_conv.this_arg);
7045 ChannelManagerReadArgs_set_keys_manager(&this_ptr_conv, val_conv);
7048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
7049 LDKChannelManagerReadArgs this_ptr_conv;
7050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7052 long ret = (long)ChannelManagerReadArgs_get_fee_estimator(&this_ptr_conv);
7056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7057 LDKChannelManagerReadArgs this_ptr_conv;
7058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7060 LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
7061 if (val_conv.free == LDKFeeEstimator_JCalls_free) {
7062 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7063 LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
7065 ChannelManagerReadArgs_set_fee_estimator(&this_ptr_conv, val_conv);
7068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
7069 LDKChannelManagerReadArgs this_ptr_conv;
7070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7072 long ret = (long)ChannelManagerReadArgs_get_chain_monitor(&this_ptr_conv);
7076 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1chain_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7077 LDKChannelManagerReadArgs this_ptr_conv;
7078 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7079 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7080 LDKWatch val_conv = *(LDKWatch*)val;
7081 if (val_conv.free == LDKWatch_JCalls_free) {
7082 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7083 LDKWatch_JCalls_clone(val_conv.this_arg);
7085 ChannelManagerReadArgs_set_chain_monitor(&this_ptr_conv, val_conv);
7088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
7089 LDKChannelManagerReadArgs this_ptr_conv;
7090 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7091 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7092 long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(&this_ptr_conv);
7096 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7097 LDKChannelManagerReadArgs this_ptr_conv;
7098 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7099 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7100 LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
7101 if (val_conv.free == LDKBroadcasterInterface_JCalls_free) {
7102 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7103 LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
7105 ChannelManagerReadArgs_set_tx_broadcaster(&this_ptr_conv, val_conv);
7108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
7109 LDKChannelManagerReadArgs 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 long ret = (long)ChannelManagerReadArgs_get_logger(&this_ptr_conv);
7116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7117 LDKChannelManagerReadArgs this_ptr_conv;
7118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7120 LDKLogger val_conv = *(LDKLogger*)val;
7121 if (val_conv.free == LDKLogger_JCalls_free) {
7122 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7123 LDKLogger_JCalls_clone(val_conv.this_arg);
7125 ChannelManagerReadArgs_set_logger(&this_ptr_conv, val_conv);
7128 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
7129 LDKChannelManagerReadArgs this_ptr_conv;
7130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7132 LDKUserConfig ret = ChannelManagerReadArgs_get_default_config(&this_ptr_conv);
7133 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7136 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7137 LDKChannelManagerReadArgs this_ptr_conv;
7138 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7139 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7140 LDKUserConfig val_conv;
7141 val_conv.inner = (void*)(val & (~1));
7142 val_conv.is_owned = (val & 1) || (val == 0);
7143 if (val_conv.inner != NULL)
7144 val_conv = UserConfig_clone(&val_conv);
7145 ChannelManagerReadArgs_set_default_config(&this_ptr_conv, val_conv);
7148 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, jlongArray channel_monitors) {
7149 LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
7150 if (keys_manager_conv.free == LDKKeysInterface_JCalls_free) {
7151 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7152 LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
7154 LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
7155 if (fee_estimator_conv.free == LDKFeeEstimator_JCalls_free) {
7156 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7157 LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
7159 LDKWatch chain_monitor_conv = *(LDKWatch*)chain_monitor;
7160 if (chain_monitor_conv.free == LDKWatch_JCalls_free) {
7161 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7162 LDKWatch_JCalls_clone(chain_monitor_conv.this_arg);
7164 LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
7165 if (tx_broadcaster_conv.free == LDKBroadcasterInterface_JCalls_free) {
7166 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7167 LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
7169 LDKLogger logger_conv = *(LDKLogger*)logger;
7170 if (logger_conv.free == LDKLogger_JCalls_free) {
7171 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
7172 LDKLogger_JCalls_clone(logger_conv.this_arg);
7174 LDKUserConfig default_config_conv;
7175 default_config_conv.inner = (void*)(default_config & (~1));
7176 default_config_conv.is_owned = (default_config & 1) || (default_config == 0);
7177 if (default_config_conv.inner != NULL)
7178 default_config_conv = UserConfig_clone(&default_config_conv);
7179 LDKCVec_ChannelMonitorZ channel_monitors_constr;
7180 channel_monitors_constr.datalen = (*_env)->GetArrayLength (_env, channel_monitors);
7181 if (channel_monitors_constr.datalen > 0)
7182 channel_monitors_constr.data = MALLOC(channel_monitors_constr.datalen * sizeof(LDKChannelMonitor), "LDKCVec_ChannelMonitorZ Elements");
7184 channel_monitors_constr.data = NULL;
7185 long* channel_monitors_vals = (*_env)->GetLongArrayElements (_env, channel_monitors, NULL);
7186 for (size_t q = 0; q < channel_monitors_constr.datalen; q++) {
7187 long arr_conv_16 = channel_monitors_vals[q];
7188 LDKChannelMonitor arr_conv_16_conv;
7189 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
7190 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
7191 // Warning: we may need a move here but can't clone!
7192 channel_monitors_constr.data[q] = arr_conv_16_conv;
7194 (*_env)->ReleaseLongArrayElements (_env, channel_monitors, channel_monitors_vals, 0);
7195 LDKChannelManagerReadArgs ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, chain_monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_constr);
7196 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7200 LDKDecodeError this_ptr_conv;
7201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7203 DecodeError_free(this_ptr_conv);
7206 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7207 LDKInit this_ptr_conv;
7208 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7209 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7210 Init_free(this_ptr_conv);
7213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7215 orig_conv.inner = (void*)(orig & (~1));
7216 orig_conv.is_owned = (orig & 1) || (orig == 0);
7217 LDKInit ret = Init_clone(&orig_conv);
7218 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7222 LDKErrorMessage this_ptr_conv;
7223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7225 ErrorMessage_free(this_ptr_conv);
7228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7229 LDKErrorMessage orig_conv;
7230 orig_conv.inner = (void*)(orig & (~1));
7231 orig_conv.is_owned = (orig & 1) || (orig == 0);
7232 LDKErrorMessage ret = ErrorMessage_clone(&orig_conv);
7233 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7236 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7237 LDKErrorMessage this_ptr_conv;
7238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7240 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7241 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(&this_ptr_conv));
7245 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7246 LDKErrorMessage this_ptr_conv;
7247 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7248 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7249 LDKThirtyTwoBytes val_ref;
7250 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7251 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7252 ErrorMessage_set_channel_id(&this_ptr_conv, val_ref);
7255 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
7256 LDKErrorMessage this_ptr_conv;
7257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7259 LDKStr _str = ErrorMessage_get_data(&this_ptr_conv);
7260 char* _buf = MALLOC(_str.len + 1, "str conv buf");
7261 memcpy(_buf, _str.chars, _str.len);
7263 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
7268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7269 LDKErrorMessage this_ptr_conv;
7270 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7271 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7272 LDKCVec_u8Z val_ref;
7273 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
7274 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
7275 ErrorMessage_set_data(&this_ptr_conv, val_ref);
7276 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
7279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray data_arg) {
7280 LDKThirtyTwoBytes channel_id_arg_ref;
7281 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
7282 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
7283 LDKCVec_u8Z data_arg_ref;
7284 data_arg_ref.data = (*_env)->GetByteArrayElements (_env, data_arg, NULL);
7285 data_arg_ref.datalen = (*_env)->GetArrayLength (_env, data_arg);
7286 LDKErrorMessage ret = ErrorMessage_new(channel_id_arg_ref, data_arg_ref);
7287 (*_env)->ReleaseByteArrayElements(_env, data_arg, (int8_t*)data_arg_ref.data, 0);
7288 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7291 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7292 LDKPing this_ptr_conv;
7293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7295 Ping_free(this_ptr_conv);
7298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7300 orig_conv.inner = (void*)(orig & (~1));
7301 orig_conv.is_owned = (orig & 1) || (orig == 0);
7302 LDKPing ret = Ping_clone(&orig_conv);
7303 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7306 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7307 LDKPing this_ptr_conv;
7308 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7309 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7310 jshort ret_val = Ping_get_ponglen(&this_ptr_conv);
7314 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7315 LDKPing this_ptr_conv;
7316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7318 Ping_set_ponglen(&this_ptr_conv, val);
7321 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7322 LDKPing this_ptr_conv;
7323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7325 jshort ret_val = Ping_get_byteslen(&this_ptr_conv);
7329 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7330 LDKPing this_ptr_conv;
7331 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7332 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7333 Ping_set_byteslen(&this_ptr_conv, val);
7336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
7337 LDKPing ret = Ping_new(ponglen_arg, byteslen_arg);
7338 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7342 LDKPong this_ptr_conv;
7343 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7344 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7345 Pong_free(this_ptr_conv);
7348 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7350 orig_conv.inner = (void*)(orig & (~1));
7351 orig_conv.is_owned = (orig & 1) || (orig == 0);
7352 LDKPong ret = Pong_clone(&orig_conv);
7353 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7356 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
7357 LDKPong this_ptr_conv;
7358 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7359 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7360 jshort ret_val = Pong_get_byteslen(&this_ptr_conv);
7364 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7365 LDKPong this_ptr_conv;
7366 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7367 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7368 Pong_set_byteslen(&this_ptr_conv, val);
7371 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
7372 LDKPong ret = Pong_new(byteslen_arg);
7373 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7377 LDKOpenChannel this_ptr_conv;
7378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7380 OpenChannel_free(this_ptr_conv);
7383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7384 LDKOpenChannel orig_conv;
7385 orig_conv.inner = (void*)(orig & (~1));
7386 orig_conv.is_owned = (orig & 1) || (orig == 0);
7387 LDKOpenChannel ret = OpenChannel_clone(&orig_conv);
7388 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7391 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
7392 LDKOpenChannel this_ptr_conv;
7393 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7394 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7395 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7396 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(&this_ptr_conv));
7400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7401 LDKOpenChannel this_ptr_conv;
7402 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7403 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7404 LDKThirtyTwoBytes val_ref;
7405 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7406 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7407 OpenChannel_set_chain_hash(&this_ptr_conv, val_ref);
7410 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7411 LDKOpenChannel 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7415 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(&this_ptr_conv));
7419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7420 LDKOpenChannel this_ptr_conv;
7421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7423 LDKThirtyTwoBytes val_ref;
7424 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7425 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7426 OpenChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7429 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7430 LDKOpenChannel 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 jlong ret_val = OpenChannel_get_funding_satoshis(&this_ptr_conv);
7437 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7438 LDKOpenChannel this_ptr_conv;
7439 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7440 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7441 OpenChannel_set_funding_satoshis(&this_ptr_conv, val);
7444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7445 LDKOpenChannel 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 jlong ret_val = OpenChannel_get_push_msat(&this_ptr_conv);
7452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7453 LDKOpenChannel this_ptr_conv;
7454 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7455 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7456 OpenChannel_set_push_msat(&this_ptr_conv, val);
7459 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7460 LDKOpenChannel this_ptr_conv;
7461 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7462 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7463 jlong ret_val = OpenChannel_get_dust_limit_satoshis(&this_ptr_conv);
7467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7468 LDKOpenChannel this_ptr_conv;
7469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7471 OpenChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7475 LDKOpenChannel this_ptr_conv;
7476 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7477 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7478 jlong ret_val = OpenChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7482 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) {
7483 LDKOpenChannel this_ptr_conv;
7484 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7485 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7486 OpenChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7489 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7490 LDKOpenChannel this_ptr_conv;
7491 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7492 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7493 jlong ret_val = OpenChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7498 LDKOpenChannel this_ptr_conv;
7499 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7500 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7501 OpenChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7504 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7505 LDKOpenChannel this_ptr_conv;
7506 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7507 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7508 jlong ret_val = OpenChannel_get_htlc_minimum_msat(&this_ptr_conv);
7512 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7513 LDKOpenChannel this_ptr_conv;
7514 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7515 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7516 OpenChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7519 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
7520 LDKOpenChannel this_ptr_conv;
7521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7523 jint ret_val = OpenChannel_get_feerate_per_kw(&this_ptr_conv);
7527 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7528 LDKOpenChannel this_ptr_conv;
7529 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7530 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7531 OpenChannel_set_feerate_per_kw(&this_ptr_conv, val);
7534 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7535 LDKOpenChannel this_ptr_conv;
7536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7538 jshort ret_val = OpenChannel_get_to_self_delay(&this_ptr_conv);
7542 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7543 LDKOpenChannel 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 OpenChannel_set_to_self_delay(&this_ptr_conv, val);
7549 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7550 LDKOpenChannel this_ptr_conv;
7551 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7552 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7553 jshort ret_val = OpenChannel_get_max_accepted_htlcs(&this_ptr_conv);
7557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7558 LDKOpenChannel 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 OpenChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7564 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7565 LDKOpenChannel this_ptr_conv;
7566 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7567 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7568 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7569 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7573 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7574 LDKOpenChannel this_ptr_conv;
7575 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7576 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7577 LDKPublicKey val_ref;
7578 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7579 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7580 OpenChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7583 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7584 LDKOpenChannel this_ptr_conv;
7585 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7586 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7587 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7588 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7593 LDKOpenChannel this_ptr_conv;
7594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7596 LDKPublicKey val_ref;
7597 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7598 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7599 OpenChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7602 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7603 LDKOpenChannel this_ptr_conv;
7604 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7605 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7606 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7607 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_payment_point(&this_ptr_conv).compressed_form);
7611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7612 LDKOpenChannel this_ptr_conv;
7613 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7614 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7615 LDKPublicKey val_ref;
7616 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7617 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7618 OpenChannel_set_payment_point(&this_ptr_conv, val_ref);
7621 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7622 LDKOpenChannel 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 arg_arr = (*_env)->NewByteArray(_env, 33);
7626 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7631 LDKOpenChannel 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 LDKPublicKey val_ref;
7635 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7636 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7637 OpenChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7640 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7641 LDKOpenChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7645 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7650 LDKOpenChannel this_ptr_conv;
7651 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7652 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7653 LDKPublicKey val_ref;
7654 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7655 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7656 OpenChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7659 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7660 LDKOpenChannel this_ptr_conv;
7661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7663 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7664 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, OpenChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7669 LDKOpenChannel this_ptr_conv;
7670 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7671 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7672 LDKPublicKey val_ref;
7673 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7674 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7675 OpenChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7678 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
7679 LDKOpenChannel this_ptr_conv;
7680 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7681 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7682 jbyte ret_val = OpenChannel_get_channel_flags(&this_ptr_conv);
7686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
7687 LDKOpenChannel this_ptr_conv;
7688 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7689 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7690 OpenChannel_set_channel_flags(&this_ptr_conv, val);
7693 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7694 LDKAcceptChannel this_ptr_conv;
7695 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7696 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7697 AcceptChannel_free(this_ptr_conv);
7700 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7701 LDKAcceptChannel orig_conv;
7702 orig_conv.inner = (void*)(orig & (~1));
7703 orig_conv.is_owned = (orig & 1) || (orig == 0);
7704 LDKAcceptChannel ret = AcceptChannel_clone(&orig_conv);
7705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7708 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7709 LDKAcceptChannel this_ptr_conv;
7710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7712 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7713 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(&this_ptr_conv));
7717 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7718 LDKAcceptChannel this_ptr_conv;
7719 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7720 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7721 LDKThirtyTwoBytes val_ref;
7722 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7723 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7724 AcceptChannel_set_temporary_channel_id(&this_ptr_conv, val_ref);
7727 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7728 LDKAcceptChannel 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 jlong ret_val = AcceptChannel_get_dust_limit_satoshis(&this_ptr_conv);
7735 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7736 LDKAcceptChannel this_ptr_conv;
7737 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7738 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7739 AcceptChannel_set_dust_limit_satoshis(&this_ptr_conv, val);
7742 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7743 LDKAcceptChannel this_ptr_conv;
7744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7746 jlong ret_val = AcceptChannel_get_max_htlc_value_in_flight_msat(&this_ptr_conv);
7750 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) {
7751 LDKAcceptChannel this_ptr_conv;
7752 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7753 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7754 AcceptChannel_set_max_htlc_value_in_flight_msat(&this_ptr_conv, val);
7757 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
7758 LDKAcceptChannel this_ptr_conv;
7759 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7760 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7761 jlong ret_val = AcceptChannel_get_channel_reserve_satoshis(&this_ptr_conv);
7765 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7766 LDKAcceptChannel this_ptr_conv;
7767 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7768 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7769 AcceptChannel_set_channel_reserve_satoshis(&this_ptr_conv, val);
7772 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
7773 LDKAcceptChannel this_ptr_conv;
7774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7776 jlong ret_val = AcceptChannel_get_htlc_minimum_msat(&this_ptr_conv);
7780 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
7781 LDKAcceptChannel this_ptr_conv;
7782 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7783 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7784 AcceptChannel_set_htlc_minimum_msat(&this_ptr_conv, val);
7787 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
7788 LDKAcceptChannel this_ptr_conv;
7789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7791 jint ret_val = AcceptChannel_get_minimum_depth(&this_ptr_conv);
7795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
7796 LDKAcceptChannel this_ptr_conv;
7797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7799 AcceptChannel_set_minimum_depth(&this_ptr_conv, val);
7802 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
7803 LDKAcceptChannel this_ptr_conv;
7804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7806 jshort ret_val = AcceptChannel_get_to_self_delay(&this_ptr_conv);
7810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7811 LDKAcceptChannel this_ptr_conv;
7812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7814 AcceptChannel_set_to_self_delay(&this_ptr_conv, val);
7817 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
7818 LDKAcceptChannel this_ptr_conv;
7819 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7820 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7821 jshort ret_val = AcceptChannel_get_max_accepted_htlcs(&this_ptr_conv);
7825 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
7826 LDKAcceptChannel this_ptr_conv;
7827 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7828 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7829 AcceptChannel_set_max_accepted_htlcs(&this_ptr_conv, val);
7832 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
7833 LDKAcceptChannel 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, 33);
7837 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_funding_pubkey(&this_ptr_conv).compressed_form);
7841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7842 LDKAcceptChannel 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 LDKPublicKey val_ref;
7846 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7847 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7848 AcceptChannel_set_funding_pubkey(&this_ptr_conv, val_ref);
7851 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7852 LDKAcceptChannel 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7856 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_revocation_basepoint(&this_ptr_conv).compressed_form);
7860 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7861 LDKAcceptChannel this_ptr_conv;
7862 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7863 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7864 LDKPublicKey val_ref;
7865 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7866 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7867 AcceptChannel_set_revocation_basepoint(&this_ptr_conv, val_ref);
7870 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7871 LDKAcceptChannel this_ptr_conv;
7872 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7873 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7874 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7875 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_payment_point(&this_ptr_conv).compressed_form);
7879 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7880 LDKAcceptChannel this_ptr_conv;
7881 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7882 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7883 LDKPublicKey val_ref;
7884 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7885 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7886 AcceptChannel_set_payment_point(&this_ptr_conv, val_ref);
7889 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7890 LDKAcceptChannel this_ptr_conv;
7891 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7892 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7893 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7894 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
7898 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7899 LDKAcceptChannel this_ptr_conv;
7900 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7901 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7902 LDKPublicKey val_ref;
7903 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7904 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7905 AcceptChannel_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
7908 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
7909 LDKAcceptChannel this_ptr_conv;
7910 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7911 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7912 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7913 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_htlc_basepoint(&this_ptr_conv).compressed_form);
7917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7918 LDKAcceptChannel this_ptr_conv;
7919 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7920 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7921 LDKPublicKey val_ref;
7922 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7923 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7924 AcceptChannel_set_htlc_basepoint(&this_ptr_conv, val_ref);
7927 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
7928 LDKAcceptChannel this_ptr_conv;
7929 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7930 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7931 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
7932 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, AcceptChannel_get_first_per_commitment_point(&this_ptr_conv).compressed_form);
7936 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7937 LDKAcceptChannel this_ptr_conv;
7938 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7939 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7940 LDKPublicKey val_ref;
7941 CHECK((*_env)->GetArrayLength (_env, val) == 33);
7942 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
7943 AcceptChannel_set_first_per_commitment_point(&this_ptr_conv, val_ref);
7946 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
7947 LDKFundingCreated this_ptr_conv;
7948 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7949 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7950 FundingCreated_free(this_ptr_conv);
7953 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1clone(JNIEnv * _env, jclass _b, jlong orig) {
7954 LDKFundingCreated orig_conv;
7955 orig_conv.inner = (void*)(orig & (~1));
7956 orig_conv.is_owned = (orig & 1) || (orig == 0);
7957 LDKFundingCreated ret = FundingCreated_clone(&orig_conv);
7958 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
7961 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
7962 LDKFundingCreated this_ptr_conv;
7963 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7964 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7965 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7966 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(&this_ptr_conv));
7970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7971 LDKFundingCreated this_ptr_conv;
7972 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7973 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7974 LDKThirtyTwoBytes val_ref;
7975 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7976 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7977 FundingCreated_set_temporary_channel_id(&this_ptr_conv, val_ref);
7980 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
7981 LDKFundingCreated this_ptr_conv;
7982 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7983 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7984 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
7985 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(&this_ptr_conv));
7989 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
7990 LDKFundingCreated this_ptr_conv;
7991 this_ptr_conv.inner = (void*)(this_ptr & (~1));
7992 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
7993 LDKThirtyTwoBytes val_ref;
7994 CHECK((*_env)->GetArrayLength (_env, val) == 32);
7995 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
7996 FundingCreated_set_funding_txid(&this_ptr_conv, val_ref);
7999 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
8000 LDKFundingCreated this_ptr_conv;
8001 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8002 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8003 jshort ret_val = FundingCreated_get_funding_output_index(&this_ptr_conv);
8007 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8008 LDKFundingCreated this_ptr_conv;
8009 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8010 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8011 FundingCreated_set_funding_output_index(&this_ptr_conv, val);
8014 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8015 LDKFundingCreated this_ptr_conv;
8016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8018 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8019 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingCreated_get_signature(&this_ptr_conv).compact_form);
8023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8024 LDKFundingCreated this_ptr_conv;
8025 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8026 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8027 LDKSignature val_ref;
8028 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8029 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8030 FundingCreated_set_signature(&this_ptr_conv, val_ref);
8033 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) {
8034 LDKThirtyTwoBytes temporary_channel_id_arg_ref;
8035 CHECK((*_env)->GetArrayLength (_env, temporary_channel_id_arg) == 32);
8036 (*_env)->GetByteArrayRegion (_env, temporary_channel_id_arg, 0, 32, temporary_channel_id_arg_ref.data);
8037 LDKThirtyTwoBytes funding_txid_arg_ref;
8038 CHECK((*_env)->GetArrayLength (_env, funding_txid_arg) == 32);
8039 (*_env)->GetByteArrayRegion (_env, funding_txid_arg, 0, 32, funding_txid_arg_ref.data);
8040 LDKSignature signature_arg_ref;
8041 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8042 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8043 LDKFundingCreated ret = FundingCreated_new(temporary_channel_id_arg_ref, funding_txid_arg_ref, funding_output_index_arg, signature_arg_ref);
8044 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8047 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8048 LDKFundingSigned this_ptr_conv;
8049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8051 FundingSigned_free(this_ptr_conv);
8054 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8055 LDKFundingSigned orig_conv;
8056 orig_conv.inner = (void*)(orig & (~1));
8057 orig_conv.is_owned = (orig & 1) || (orig == 0);
8058 LDKFundingSigned ret = FundingSigned_clone(&orig_conv);
8059 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8062 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8063 LDKFundingSigned this_ptr_conv;
8064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8066 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8067 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(&this_ptr_conv));
8071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8072 LDKFundingSigned this_ptr_conv;
8073 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8074 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8075 LDKThirtyTwoBytes val_ref;
8076 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8077 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8078 FundingSigned_set_channel_id(&this_ptr_conv, val_ref);
8081 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8082 LDKFundingSigned this_ptr_conv;
8083 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8084 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8085 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8086 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, FundingSigned_get_signature(&this_ptr_conv).compact_form);
8090 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8091 LDKFundingSigned this_ptr_conv;
8092 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8093 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8094 LDKSignature val_ref;
8095 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8096 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8097 FundingSigned_set_signature(&this_ptr_conv, val_ref);
8100 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg) {
8101 LDKThirtyTwoBytes channel_id_arg_ref;
8102 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8103 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8104 LDKSignature signature_arg_ref;
8105 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8106 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8107 LDKFundingSigned ret = FundingSigned_new(channel_id_arg_ref, signature_arg_ref);
8108 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8111 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8112 LDKFundingLocked this_ptr_conv;
8113 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8114 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8115 FundingLocked_free(this_ptr_conv);
8118 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8119 LDKFundingLocked orig_conv;
8120 orig_conv.inner = (void*)(orig & (~1));
8121 orig_conv.is_owned = (orig & 1) || (orig == 0);
8122 LDKFundingLocked ret = FundingLocked_clone(&orig_conv);
8123 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8126 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8127 LDKFundingLocked this_ptr_conv;
8128 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8129 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8130 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8131 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(&this_ptr_conv));
8135 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8136 LDKFundingLocked this_ptr_conv;
8137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8139 LDKThirtyTwoBytes val_ref;
8140 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8141 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8142 FundingLocked_set_channel_id(&this_ptr_conv, val_ref);
8145 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8146 LDKFundingLocked this_ptr_conv;
8147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8149 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8150 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, FundingLocked_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8154 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8155 LDKFundingLocked this_ptr_conv;
8156 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8157 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8158 LDKPublicKey val_ref;
8159 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8160 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8161 FundingLocked_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8164 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray next_per_commitment_point_arg) {
8165 LDKThirtyTwoBytes channel_id_arg_ref;
8166 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8167 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8168 LDKPublicKey next_per_commitment_point_arg_ref;
8169 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8170 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8171 LDKFundingLocked ret = FundingLocked_new(channel_id_arg_ref, next_per_commitment_point_arg_ref);
8172 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8175 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8176 LDKShutdown this_ptr_conv;
8177 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8178 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8179 Shutdown_free(this_ptr_conv);
8182 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8183 LDKShutdown orig_conv;
8184 orig_conv.inner = (void*)(orig & (~1));
8185 orig_conv.is_owned = (orig & 1) || (orig == 0);
8186 LDKShutdown ret = Shutdown_clone(&orig_conv);
8187 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8190 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8191 LDKShutdown this_ptr_conv;
8192 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8193 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8194 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8195 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(&this_ptr_conv));
8199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8200 LDKShutdown this_ptr_conv;
8201 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8202 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8203 LDKThirtyTwoBytes val_ref;
8204 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8205 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8206 Shutdown_set_channel_id(&this_ptr_conv, val_ref);
8209 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
8210 LDKShutdown this_ptr_conv;
8211 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8212 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8213 LDKu8slice arg_var = Shutdown_get_scriptpubkey(&this_ptr_conv);
8214 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
8215 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
8219 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8220 LDKShutdown this_ptr_conv;
8221 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8222 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8223 LDKCVec_u8Z val_ref;
8224 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
8225 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
8226 Shutdown_set_scriptpubkey(&this_ptr_conv, val_ref);
8227 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
8230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray scriptpubkey_arg) {
8231 LDKThirtyTwoBytes channel_id_arg_ref;
8232 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8233 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8234 LDKCVec_u8Z scriptpubkey_arg_ref;
8235 scriptpubkey_arg_ref.data = (*_env)->GetByteArrayElements (_env, scriptpubkey_arg, NULL);
8236 scriptpubkey_arg_ref.datalen = (*_env)->GetArrayLength (_env, scriptpubkey_arg);
8237 LDKShutdown ret = Shutdown_new(channel_id_arg_ref, scriptpubkey_arg_ref);
8238 (*_env)->ReleaseByteArrayElements(_env, scriptpubkey_arg, (int8_t*)scriptpubkey_arg_ref.data, 0);
8239 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8243 LDKClosingSigned this_ptr_conv;
8244 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8245 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8246 ClosingSigned_free(this_ptr_conv);
8249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8250 LDKClosingSigned orig_conv;
8251 orig_conv.inner = (void*)(orig & (~1));
8252 orig_conv.is_owned = (orig & 1) || (orig == 0);
8253 LDKClosingSigned ret = ClosingSigned_clone(&orig_conv);
8254 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8257 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8258 LDKClosingSigned this_ptr_conv;
8259 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8260 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8261 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8262 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(&this_ptr_conv));
8266 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8267 LDKClosingSigned 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 LDKThirtyTwoBytes val_ref;
8271 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8272 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8273 ClosingSigned_set_channel_id(&this_ptr_conv, val_ref);
8276 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
8277 LDKClosingSigned this_ptr_conv;
8278 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8279 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8280 jlong ret_val = ClosingSigned_get_fee_satoshis(&this_ptr_conv);
8284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8285 LDKClosingSigned this_ptr_conv;
8286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8288 ClosingSigned_set_fee_satoshis(&this_ptr_conv, val);
8291 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8292 LDKClosingSigned this_ptr_conv;
8293 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8294 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8295 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8296 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ClosingSigned_get_signature(&this_ptr_conv).compact_form);
8300 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8301 LDKClosingSigned 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 LDKSignature val_ref;
8305 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8306 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8307 ClosingSigned_set_signature(&this_ptr_conv, val_ref);
8310 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) {
8311 LDKThirtyTwoBytes channel_id_arg_ref;
8312 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8313 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8314 LDKSignature signature_arg_ref;
8315 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8316 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8317 LDKClosingSigned ret = ClosingSigned_new(channel_id_arg_ref, fee_satoshis_arg, signature_arg_ref);
8318 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8322 LDKUpdateAddHTLC this_ptr_conv;
8323 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8324 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8325 UpdateAddHTLC_free(this_ptr_conv);
8328 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8329 LDKUpdateAddHTLC orig_conv;
8330 orig_conv.inner = (void*)(orig & (~1));
8331 orig_conv.is_owned = (orig & 1) || (orig == 0);
8332 LDKUpdateAddHTLC ret = UpdateAddHTLC_clone(&orig_conv);
8333 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8336 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8337 LDKUpdateAddHTLC this_ptr_conv;
8338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8340 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8341 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(&this_ptr_conv));
8345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8346 LDKUpdateAddHTLC this_ptr_conv;
8347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8349 LDKThirtyTwoBytes val_ref;
8350 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8351 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8352 UpdateAddHTLC_set_channel_id(&this_ptr_conv, val_ref);
8355 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8356 LDKUpdateAddHTLC this_ptr_conv;
8357 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8358 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8359 jlong ret_val = UpdateAddHTLC_get_htlc_id(&this_ptr_conv);
8363 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8364 LDKUpdateAddHTLC this_ptr_conv;
8365 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8366 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8367 UpdateAddHTLC_set_htlc_id(&this_ptr_conv, val);
8370 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
8371 LDKUpdateAddHTLC this_ptr_conv;
8372 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8373 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8374 jlong ret_val = UpdateAddHTLC_get_amount_msat(&this_ptr_conv);
8378 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8379 LDKUpdateAddHTLC this_ptr_conv;
8380 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8381 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8382 UpdateAddHTLC_set_amount_msat(&this_ptr_conv, val);
8385 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
8386 LDKUpdateAddHTLC this_ptr_conv;
8387 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8388 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8389 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8390 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(&this_ptr_conv));
8394 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8395 LDKUpdateAddHTLC this_ptr_conv;
8396 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8397 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8398 LDKThirtyTwoBytes val_ref;
8399 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8400 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8401 UpdateAddHTLC_set_payment_hash(&this_ptr_conv, val_ref);
8404 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
8405 LDKUpdateAddHTLC this_ptr_conv;
8406 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8407 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8408 jint ret_val = UpdateAddHTLC_get_cltv_expiry(&this_ptr_conv);
8412 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8413 LDKUpdateAddHTLC this_ptr_conv;
8414 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8415 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8416 UpdateAddHTLC_set_cltv_expiry(&this_ptr_conv, val);
8419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8420 LDKUpdateFulfillHTLC this_ptr_conv;
8421 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8422 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8423 UpdateFulfillHTLC_free(this_ptr_conv);
8426 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8427 LDKUpdateFulfillHTLC orig_conv;
8428 orig_conv.inner = (void*)(orig & (~1));
8429 orig_conv.is_owned = (orig & 1) || (orig == 0);
8430 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_clone(&orig_conv);
8431 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8434 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8435 LDKUpdateFulfillHTLC this_ptr_conv;
8436 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8437 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8438 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8439 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(&this_ptr_conv));
8443 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8444 LDKUpdateFulfillHTLC this_ptr_conv;
8445 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8446 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8447 LDKThirtyTwoBytes val_ref;
8448 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8449 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8450 UpdateFulfillHTLC_set_channel_id(&this_ptr_conv, val_ref);
8453 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8454 LDKUpdateFulfillHTLC this_ptr_conv;
8455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8457 jlong ret_val = UpdateFulfillHTLC_get_htlc_id(&this_ptr_conv);
8461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8462 LDKUpdateFulfillHTLC this_ptr_conv;
8463 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8464 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8465 UpdateFulfillHTLC_set_htlc_id(&this_ptr_conv, val);
8468 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
8469 LDKUpdateFulfillHTLC this_ptr_conv;
8470 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8471 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8472 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8473 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(&this_ptr_conv));
8477 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8478 LDKUpdateFulfillHTLC this_ptr_conv;
8479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8481 LDKThirtyTwoBytes val_ref;
8482 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8483 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8484 UpdateFulfillHTLC_set_payment_preimage(&this_ptr_conv, val_ref);
8487 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) {
8488 LDKThirtyTwoBytes channel_id_arg_ref;
8489 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8490 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8491 LDKThirtyTwoBytes payment_preimage_arg_ref;
8492 CHECK((*_env)->GetArrayLength (_env, payment_preimage_arg) == 32);
8493 (*_env)->GetByteArrayRegion (_env, payment_preimage_arg, 0, 32, payment_preimage_arg_ref.data);
8494 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_new(channel_id_arg_ref, htlc_id_arg, payment_preimage_arg_ref);
8495 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8498 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8499 LDKUpdateFailHTLC this_ptr_conv;
8500 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8501 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8502 UpdateFailHTLC_free(this_ptr_conv);
8505 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8506 LDKUpdateFailHTLC orig_conv;
8507 orig_conv.inner = (void*)(orig & (~1));
8508 orig_conv.is_owned = (orig & 1) || (orig == 0);
8509 LDKUpdateFailHTLC ret = UpdateFailHTLC_clone(&orig_conv);
8510 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8513 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8514 LDKUpdateFailHTLC this_ptr_conv;
8515 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8516 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8517 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8518 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(&this_ptr_conv));
8522 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8523 LDKUpdateFailHTLC this_ptr_conv;
8524 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8525 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8526 LDKThirtyTwoBytes val_ref;
8527 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8528 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8529 UpdateFailHTLC_set_channel_id(&this_ptr_conv, val_ref);
8532 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8533 LDKUpdateFailHTLC this_ptr_conv;
8534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8536 jlong ret_val = UpdateFailHTLC_get_htlc_id(&this_ptr_conv);
8540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8541 LDKUpdateFailHTLC this_ptr_conv;
8542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8544 UpdateFailHTLC_set_htlc_id(&this_ptr_conv, val);
8547 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8548 LDKUpdateFailMalformedHTLC this_ptr_conv;
8549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8551 UpdateFailMalformedHTLC_free(this_ptr_conv);
8554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8555 LDKUpdateFailMalformedHTLC orig_conv;
8556 orig_conv.inner = (void*)(orig & (~1));
8557 orig_conv.is_owned = (orig & 1) || (orig == 0);
8558 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_clone(&orig_conv);
8559 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8562 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8563 LDKUpdateFailMalformedHTLC this_ptr_conv;
8564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8566 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8567 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(&this_ptr_conv));
8571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8572 LDKUpdateFailMalformedHTLC this_ptr_conv;
8573 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8574 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8575 LDKThirtyTwoBytes val_ref;
8576 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8577 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8578 UpdateFailMalformedHTLC_set_channel_id(&this_ptr_conv, val_ref);
8581 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8582 LDKUpdateFailMalformedHTLC this_ptr_conv;
8583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8585 jlong ret_val = UpdateFailMalformedHTLC_get_htlc_id(&this_ptr_conv);
8589 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8590 LDKUpdateFailMalformedHTLC this_ptr_conv;
8591 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8592 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8593 UpdateFailMalformedHTLC_set_htlc_id(&this_ptr_conv, val);
8596 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
8597 LDKUpdateFailMalformedHTLC this_ptr_conv;
8598 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8599 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8600 jshort ret_val = UpdateFailMalformedHTLC_get_failure_code(&this_ptr_conv);
8604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
8605 LDKUpdateFailMalformedHTLC this_ptr_conv;
8606 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8607 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8608 UpdateFailMalformedHTLC_set_failure_code(&this_ptr_conv, val);
8611 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8612 LDKCommitmentSigned 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 CommitmentSigned_free(this_ptr_conv);
8618 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8619 LDKCommitmentSigned orig_conv;
8620 orig_conv.inner = (void*)(orig & (~1));
8621 orig_conv.is_owned = (orig & 1) || (orig == 0);
8622 LDKCommitmentSigned ret = CommitmentSigned_clone(&orig_conv);
8623 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8626 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8627 LDKCommitmentSigned this_ptr_conv;
8628 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8629 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8630 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8631 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(&this_ptr_conv));
8635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8636 LDKCommitmentSigned this_ptr_conv;
8637 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8638 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8639 LDKThirtyTwoBytes val_ref;
8640 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8641 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8642 CommitmentSigned_set_channel_id(&this_ptr_conv, val_ref);
8645 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
8646 LDKCommitmentSigned this_ptr_conv;
8647 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8648 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8649 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
8650 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, CommitmentSigned_get_signature(&this_ptr_conv).compact_form);
8654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8655 LDKCommitmentSigned this_ptr_conv;
8656 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8657 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8658 LDKSignature val_ref;
8659 CHECK((*_env)->GetArrayLength (_env, val) == 64);
8660 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
8661 CommitmentSigned_set_signature(&this_ptr_conv, val_ref);
8664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
8665 LDKCommitmentSigned this_ptr_conv;
8666 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8667 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8668 LDKCVec_SignatureZ val_constr;
8669 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
8670 if (val_constr.datalen > 0)
8671 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8673 val_constr.data = NULL;
8674 for (size_t i = 0; i < val_constr.datalen; i++) {
8675 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, val, i);
8676 LDKSignature arr_conv_8_ref;
8677 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8678 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8679 val_constr.data[i] = arr_conv_8_ref;
8681 CommitmentSigned_set_htlc_signatures(&this_ptr_conv, val_constr);
8684 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jbyteArray signature_arg, jobjectArray htlc_signatures_arg) {
8685 LDKThirtyTwoBytes channel_id_arg_ref;
8686 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8687 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8688 LDKSignature signature_arg_ref;
8689 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
8690 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
8691 LDKCVec_SignatureZ htlc_signatures_arg_constr;
8692 htlc_signatures_arg_constr.datalen = (*_env)->GetArrayLength (_env, htlc_signatures_arg);
8693 if (htlc_signatures_arg_constr.datalen > 0)
8694 htlc_signatures_arg_constr.data = MALLOC(htlc_signatures_arg_constr.datalen * sizeof(LDKSignature), "LDKCVec_SignatureZ Elements");
8696 htlc_signatures_arg_constr.data = NULL;
8697 for (size_t i = 0; i < htlc_signatures_arg_constr.datalen; i++) {
8698 jobject arr_conv_8 = (*_env)->GetObjectArrayElement(_env, htlc_signatures_arg, i);
8699 LDKSignature arr_conv_8_ref;
8700 CHECK((*_env)->GetArrayLength (_env, arr_conv_8) == 64);
8701 (*_env)->GetByteArrayRegion (_env, arr_conv_8, 0, 64, arr_conv_8_ref.compact_form);
8702 htlc_signatures_arg_constr.data[i] = arr_conv_8_ref;
8704 LDKCommitmentSigned ret = CommitmentSigned_new(channel_id_arg_ref, signature_arg_ref, htlc_signatures_arg_constr);
8705 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8708 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8709 LDKRevokeAndACK this_ptr_conv;
8710 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8711 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8712 RevokeAndACK_free(this_ptr_conv);
8715 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8716 LDKRevokeAndACK orig_conv;
8717 orig_conv.inner = (void*)(orig & (~1));
8718 orig_conv.is_owned = (orig & 1) || (orig == 0);
8719 LDKRevokeAndACK ret = RevokeAndACK_clone(&orig_conv);
8720 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8723 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8724 LDKRevokeAndACK this_ptr_conv;
8725 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8726 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8727 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8728 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(&this_ptr_conv));
8732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8733 LDKRevokeAndACK this_ptr_conv;
8734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8736 LDKThirtyTwoBytes val_ref;
8737 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8738 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8739 RevokeAndACK_set_channel_id(&this_ptr_conv, val_ref);
8742 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8743 LDKRevokeAndACK this_ptr_conv;
8744 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8745 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8746 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8747 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(&this_ptr_conv));
8751 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8752 LDKRevokeAndACK this_ptr_conv;
8753 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8754 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8755 LDKThirtyTwoBytes val_ref;
8756 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8757 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8758 RevokeAndACK_set_per_commitment_secret(&this_ptr_conv, val_ref);
8761 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8762 LDKRevokeAndACK this_ptr_conv;
8763 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8764 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8765 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8766 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RevokeAndACK_get_next_per_commitment_point(&this_ptr_conv).compressed_form);
8770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8771 LDKRevokeAndACK this_ptr_conv;
8772 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8773 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8774 LDKPublicKey val_ref;
8775 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8776 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8777 RevokeAndACK_set_next_per_commitment_point(&this_ptr_conv, val_ref);
8780 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) {
8781 LDKThirtyTwoBytes channel_id_arg_ref;
8782 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8783 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8784 LDKThirtyTwoBytes per_commitment_secret_arg_ref;
8785 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret_arg) == 32);
8786 (*_env)->GetByteArrayRegion (_env, per_commitment_secret_arg, 0, 32, per_commitment_secret_arg_ref.data);
8787 LDKPublicKey next_per_commitment_point_arg_ref;
8788 CHECK((*_env)->GetArrayLength (_env, next_per_commitment_point_arg) == 33);
8789 (*_env)->GetByteArrayRegion (_env, next_per_commitment_point_arg, 0, 33, next_per_commitment_point_arg_ref.compressed_form);
8790 LDKRevokeAndACK ret = RevokeAndACK_new(channel_id_arg_ref, per_commitment_secret_arg_ref, next_per_commitment_point_arg_ref);
8791 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8795 LDKUpdateFee this_ptr_conv;
8796 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8797 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8798 UpdateFee_free(this_ptr_conv);
8801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8802 LDKUpdateFee orig_conv;
8803 orig_conv.inner = (void*)(orig & (~1));
8804 orig_conv.is_owned = (orig & 1) || (orig == 0);
8805 LDKUpdateFee ret = UpdateFee_clone(&orig_conv);
8806 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8809 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8810 LDKUpdateFee this_ptr_conv;
8811 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8812 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8813 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8814 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(&this_ptr_conv));
8818 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8819 LDKUpdateFee this_ptr_conv;
8820 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8821 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8822 LDKThirtyTwoBytes val_ref;
8823 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8824 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8825 UpdateFee_set_channel_id(&this_ptr_conv, val_ref);
8828 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
8829 LDKUpdateFee this_ptr_conv;
8830 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8831 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8832 jint ret_val = UpdateFee_get_feerate_per_kw(&this_ptr_conv);
8836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
8837 LDKUpdateFee this_ptr_conv;
8838 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8839 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8840 UpdateFee_set_feerate_per_kw(&this_ptr_conv, val);
8843 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jbyteArray channel_id_arg, jint feerate_per_kw_arg) {
8844 LDKThirtyTwoBytes channel_id_arg_ref;
8845 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
8846 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
8847 LDKUpdateFee ret = UpdateFee_new(channel_id_arg_ref, feerate_per_kw_arg);
8848 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8851 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8852 LDKDataLossProtect this_ptr_conv;
8853 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8854 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8855 DataLossProtect_free(this_ptr_conv);
8858 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8859 LDKDataLossProtect orig_conv;
8860 orig_conv.inner = (void*)(orig & (~1));
8861 orig_conv.is_owned = (orig & 1) || (orig == 0);
8862 LDKDataLossProtect ret = DataLossProtect_clone(&orig_conv);
8863 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8866 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
8867 LDKDataLossProtect this_ptr_conv;
8868 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8869 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8870 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8871 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(&this_ptr_conv));
8875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8876 LDKDataLossProtect this_ptr_conv;
8877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8879 LDKThirtyTwoBytes val_ref;
8880 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8881 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8882 DataLossProtect_set_your_last_per_commitment_secret(&this_ptr_conv, val_ref);
8885 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
8886 LDKDataLossProtect this_ptr_conv;
8887 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8888 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8889 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
8890 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, DataLossProtect_get_my_current_per_commitment_point(&this_ptr_conv).compressed_form);
8894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8895 LDKDataLossProtect this_ptr_conv;
8896 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8897 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8898 LDKPublicKey val_ref;
8899 CHECK((*_env)->GetArrayLength (_env, val) == 33);
8900 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
8901 DataLossProtect_set_my_current_per_commitment_point(&this_ptr_conv, val_ref);
8904 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) {
8905 LDKThirtyTwoBytes your_last_per_commitment_secret_arg_ref;
8906 CHECK((*_env)->GetArrayLength (_env, your_last_per_commitment_secret_arg) == 32);
8907 (*_env)->GetByteArrayRegion (_env, your_last_per_commitment_secret_arg, 0, 32, your_last_per_commitment_secret_arg_ref.data);
8908 LDKPublicKey my_current_per_commitment_point_arg_ref;
8909 CHECK((*_env)->GetArrayLength (_env, my_current_per_commitment_point_arg) == 33);
8910 (*_env)->GetByteArrayRegion (_env, my_current_per_commitment_point_arg, 0, 33, my_current_per_commitment_point_arg_ref.compressed_form);
8911 LDKDataLossProtect ret = DataLossProtect_new(your_last_per_commitment_secret_arg_ref, my_current_per_commitment_point_arg_ref);
8912 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8915 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8916 LDKChannelReestablish this_ptr_conv;
8917 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8918 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8919 ChannelReestablish_free(this_ptr_conv);
8922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8923 LDKChannelReestablish orig_conv;
8924 orig_conv.inner = (void*)(orig & (~1));
8925 orig_conv.is_owned = (orig & 1) || (orig == 0);
8926 LDKChannelReestablish ret = ChannelReestablish_clone(&orig_conv);
8927 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8930 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8931 LDKChannelReestablish this_ptr_conv;
8932 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8933 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8934 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8935 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(&this_ptr_conv));
8939 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
8940 LDKChannelReestablish this_ptr_conv;
8941 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8942 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8943 LDKThirtyTwoBytes val_ref;
8944 CHECK((*_env)->GetArrayLength (_env, val) == 32);
8945 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
8946 ChannelReestablish_set_channel_id(&this_ptr_conv, val_ref);
8949 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8950 LDKChannelReestablish this_ptr_conv;
8951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8953 jlong ret_val = ChannelReestablish_get_next_local_commitment_number(&this_ptr_conv);
8957 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8958 LDKChannelReestablish this_ptr_conv;
8959 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8960 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8961 ChannelReestablish_set_next_local_commitment_number(&this_ptr_conv, val);
8964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
8965 LDKChannelReestablish this_ptr_conv;
8966 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8967 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8968 jlong ret_val = ChannelReestablish_get_next_remote_commitment_number(&this_ptr_conv);
8972 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
8973 LDKChannelReestablish this_ptr_conv;
8974 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8975 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8976 ChannelReestablish_set_next_remote_commitment_number(&this_ptr_conv, val);
8979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
8980 LDKAnnouncementSignatures this_ptr_conv;
8981 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8982 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8983 AnnouncementSignatures_free(this_ptr_conv);
8986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1clone(JNIEnv * _env, jclass _b, jlong orig) {
8987 LDKAnnouncementSignatures orig_conv;
8988 orig_conv.inner = (void*)(orig & (~1));
8989 orig_conv.is_owned = (orig & 1) || (orig == 0);
8990 LDKAnnouncementSignatures ret = AnnouncementSignatures_clone(&orig_conv);
8991 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
8994 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
8995 LDKAnnouncementSignatures this_ptr_conv;
8996 this_ptr_conv.inner = (void*)(this_ptr & (~1));
8997 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
8998 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
8999 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(&this_ptr_conv));
9003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9004 LDKAnnouncementSignatures this_ptr_conv;
9005 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9006 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9007 LDKThirtyTwoBytes val_ref;
9008 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9009 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9010 AnnouncementSignatures_set_channel_id(&this_ptr_conv, val_ref);
9013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9014 LDKAnnouncementSignatures this_ptr_conv;
9015 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9016 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9017 jlong ret_val = AnnouncementSignatures_get_short_channel_id(&this_ptr_conv);
9021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9022 LDKAnnouncementSignatures this_ptr_conv;
9023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9025 AnnouncementSignatures_set_short_channel_id(&this_ptr_conv, val);
9028 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9029 LDKAnnouncementSignatures this_ptr_conv;
9030 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9031 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9032 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9033 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_node_signature(&this_ptr_conv).compact_form);
9037 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9038 LDKAnnouncementSignatures 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 LDKSignature val_ref;
9042 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9043 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9044 AnnouncementSignatures_set_node_signature(&this_ptr_conv, val_ref);
9047 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9048 LDKAnnouncementSignatures this_ptr_conv;
9049 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9050 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9051 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9052 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, AnnouncementSignatures_get_bitcoin_signature(&this_ptr_conv).compact_form);
9056 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9057 LDKAnnouncementSignatures this_ptr_conv;
9058 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9059 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9060 LDKSignature val_ref;
9061 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9062 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9063 AnnouncementSignatures_set_bitcoin_signature(&this_ptr_conv, val_ref);
9066 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) {
9067 LDKThirtyTwoBytes channel_id_arg_ref;
9068 CHECK((*_env)->GetArrayLength (_env, channel_id_arg) == 32);
9069 (*_env)->GetByteArrayRegion (_env, channel_id_arg, 0, 32, channel_id_arg_ref.data);
9070 LDKSignature node_signature_arg_ref;
9071 CHECK((*_env)->GetArrayLength (_env, node_signature_arg) == 64);
9072 (*_env)->GetByteArrayRegion (_env, node_signature_arg, 0, 64, node_signature_arg_ref.compact_form);
9073 LDKSignature bitcoin_signature_arg_ref;
9074 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_arg) == 64);
9075 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_arg, 0, 64, bitcoin_signature_arg_ref.compact_form);
9076 LDKAnnouncementSignatures ret = AnnouncementSignatures_new(channel_id_arg_ref, short_channel_id_arg, node_signature_arg_ref, bitcoin_signature_arg_ref);
9077 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9080 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9081 LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
9082 FREE((void*)this_ptr);
9083 NetAddress_free(this_ptr_conv);
9086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9087 LDKUnsignedNodeAnnouncement 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 UnsignedNodeAnnouncement_free(this_ptr_conv);
9093 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9094 LDKUnsignedNodeAnnouncement orig_conv;
9095 orig_conv.inner = (void*)(orig & (~1));
9096 orig_conv.is_owned = (orig & 1) || (orig == 0);
9097 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_clone(&orig_conv);
9098 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9101 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9102 LDKUnsignedNodeAnnouncement 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 LDKNodeFeatures ret = UnsignedNodeAnnouncement_get_features(&this_ptr_conv);
9106 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9109 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9110 LDKUnsignedNodeAnnouncement this_ptr_conv;
9111 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9112 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9113 LDKNodeFeatures val_conv;
9114 val_conv.inner = (void*)(val & (~1));
9115 val_conv.is_owned = (val & 1) || (val == 0);
9116 // Warning: we may need a move here but can't clone!
9117 UnsignedNodeAnnouncement_set_features(&this_ptr_conv, val_conv);
9120 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9121 LDKUnsignedNodeAnnouncement 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 jint ret_val = UnsignedNodeAnnouncement_get_timestamp(&this_ptr_conv);
9128 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9129 LDKUnsignedNodeAnnouncement this_ptr_conv;
9130 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9131 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9132 UnsignedNodeAnnouncement_set_timestamp(&this_ptr_conv, val);
9135 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9136 LDKUnsignedNodeAnnouncement this_ptr_conv;
9137 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9138 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9139 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9140 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedNodeAnnouncement_get_node_id(&this_ptr_conv).compressed_form);
9144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9145 LDKUnsignedNodeAnnouncement this_ptr_conv;
9146 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9147 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9148 LDKPublicKey val_ref;
9149 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9150 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9151 UnsignedNodeAnnouncement_set_node_id(&this_ptr_conv, val_ref);
9154 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
9155 LDKUnsignedNodeAnnouncement 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, 3);
9159 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(&this_ptr_conv));
9163 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9164 LDKUnsignedNodeAnnouncement 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 LDKThreeBytes val_ref;
9168 CHECK((*_env)->GetArrayLength (_env, val) == 3);
9169 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
9170 UnsignedNodeAnnouncement_set_rgb(&this_ptr_conv, val_ref);
9173 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
9174 LDKUnsignedNodeAnnouncement 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 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9178 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(&this_ptr_conv));
9182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9183 LDKUnsignedNodeAnnouncement this_ptr_conv;
9184 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9185 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9186 LDKThirtyTwoBytes val_ref;
9187 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9188 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9189 UnsignedNodeAnnouncement_set_alias(&this_ptr_conv, val_ref);
9192 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9193 LDKUnsignedNodeAnnouncement this_ptr_conv;
9194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9196 LDKCVec_NetAddressZ val_constr;
9197 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9198 if (val_constr.datalen > 0)
9199 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
9201 val_constr.data = NULL;
9202 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9203 for (size_t m = 0; m < val_constr.datalen; m++) {
9204 long arr_conv_12 = val_vals[m];
9205 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
9206 FREE((void*)arr_conv_12);
9207 val_constr.data[m] = arr_conv_12_conv;
9209 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9210 UnsignedNodeAnnouncement_set_addresses(&this_ptr_conv, val_constr);
9213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9214 LDKNodeAnnouncement this_ptr_conv;
9215 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9216 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9217 NodeAnnouncement_free(this_ptr_conv);
9220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9221 LDKNodeAnnouncement orig_conv;
9222 orig_conv.inner = (void*)(orig & (~1));
9223 orig_conv.is_owned = (orig & 1) || (orig == 0);
9224 LDKNodeAnnouncement ret = NodeAnnouncement_clone(&orig_conv);
9225 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9228 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9229 LDKNodeAnnouncement this_ptr_conv;
9230 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9231 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9232 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9233 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, NodeAnnouncement_get_signature(&this_ptr_conv).compact_form);
9237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9238 LDKNodeAnnouncement this_ptr_conv;
9239 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9240 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9241 LDKSignature val_ref;
9242 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9243 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9244 NodeAnnouncement_set_signature(&this_ptr_conv, val_ref);
9247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9248 LDKNodeAnnouncement this_ptr_conv;
9249 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9250 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9251 LDKUnsignedNodeAnnouncement ret = NodeAnnouncement_get_contents(&this_ptr_conv);
9252 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9256 LDKNodeAnnouncement this_ptr_conv;
9257 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9258 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9259 LDKUnsignedNodeAnnouncement val_conv;
9260 val_conv.inner = (void*)(val & (~1));
9261 val_conv.is_owned = (val & 1) || (val == 0);
9262 if (val_conv.inner != NULL)
9263 val_conv = UnsignedNodeAnnouncement_clone(&val_conv);
9264 NodeAnnouncement_set_contents(&this_ptr_conv, val_conv);
9267 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9268 LDKSignature signature_arg_ref;
9269 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9270 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9271 LDKUnsignedNodeAnnouncement contents_arg_conv;
9272 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9273 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9274 if (contents_arg_conv.inner != NULL)
9275 contents_arg_conv = UnsignedNodeAnnouncement_clone(&contents_arg_conv);
9276 LDKNodeAnnouncement ret = NodeAnnouncement_new(signature_arg_ref, contents_arg_conv);
9277 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9280 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9281 LDKUnsignedChannelAnnouncement this_ptr_conv;
9282 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9283 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9284 UnsignedChannelAnnouncement_free(this_ptr_conv);
9287 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9288 LDKUnsignedChannelAnnouncement orig_conv;
9289 orig_conv.inner = (void*)(orig & (~1));
9290 orig_conv.is_owned = (orig & 1) || (orig == 0);
9291 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_clone(&orig_conv);
9292 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
9296 LDKUnsignedChannelAnnouncement this_ptr_conv;
9297 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9298 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9299 LDKChannelFeatures ret = UnsignedChannelAnnouncement_get_features(&this_ptr_conv);
9300 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9303 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9304 LDKUnsignedChannelAnnouncement this_ptr_conv;
9305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9307 LDKChannelFeatures val_conv;
9308 val_conv.inner = (void*)(val & (~1));
9309 val_conv.is_owned = (val & 1) || (val == 0);
9310 // Warning: we may need a move here but can't clone!
9311 UnsignedChannelAnnouncement_set_features(&this_ptr_conv, val_conv);
9314 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9315 LDKUnsignedChannelAnnouncement this_ptr_conv;
9316 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9317 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9318 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9319 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(&this_ptr_conv));
9323 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9324 LDKUnsignedChannelAnnouncement this_ptr_conv;
9325 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9326 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9327 LDKThirtyTwoBytes val_ref;
9328 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9329 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9330 UnsignedChannelAnnouncement_set_chain_hash(&this_ptr_conv, val_ref);
9333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9334 LDKUnsignedChannelAnnouncement this_ptr_conv;
9335 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9336 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9337 jlong ret_val = UnsignedChannelAnnouncement_get_short_channel_id(&this_ptr_conv);
9341 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9342 LDKUnsignedChannelAnnouncement 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 UnsignedChannelAnnouncement_set_short_channel_id(&this_ptr_conv, val);
9348 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9349 LDKUnsignedChannelAnnouncement this_ptr_conv;
9350 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9351 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9352 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9353 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_1(&this_ptr_conv).compressed_form);
9357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9358 LDKUnsignedChannelAnnouncement this_ptr_conv;
9359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9361 LDKPublicKey val_ref;
9362 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9363 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9364 UnsignedChannelAnnouncement_set_node_id_1(&this_ptr_conv, val_ref);
9367 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9368 LDKUnsignedChannelAnnouncement this_ptr_conv;
9369 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9370 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9371 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9372 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_node_id_2(&this_ptr_conv).compressed_form);
9376 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9377 LDKUnsignedChannelAnnouncement this_ptr_conv;
9378 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9379 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9380 LDKPublicKey val_ref;
9381 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9382 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9383 UnsignedChannelAnnouncement_set_node_id_2(&this_ptr_conv, val_ref);
9386 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9387 LDKUnsignedChannelAnnouncement this_ptr_conv;
9388 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9389 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9390 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9391 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_1(&this_ptr_conv).compressed_form);
9395 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9396 LDKUnsignedChannelAnnouncement this_ptr_conv;
9397 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9398 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9399 LDKPublicKey val_ref;
9400 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9401 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9402 UnsignedChannelAnnouncement_set_bitcoin_key_1(&this_ptr_conv, val_ref);
9405 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9406 LDKUnsignedChannelAnnouncement 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
9410 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, UnsignedChannelAnnouncement_get_bitcoin_key_2(&this_ptr_conv).compressed_form);
9414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9415 LDKUnsignedChannelAnnouncement this_ptr_conv;
9416 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9417 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9418 LDKPublicKey val_ref;
9419 CHECK((*_env)->GetArrayLength (_env, val) == 33);
9420 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
9421 UnsignedChannelAnnouncement_set_bitcoin_key_2(&this_ptr_conv, val_ref);
9424 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9425 LDKChannelAnnouncement this_ptr_conv;
9426 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9427 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9428 ChannelAnnouncement_free(this_ptr_conv);
9431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9432 LDKChannelAnnouncement orig_conv;
9433 orig_conv.inner = (void*)(orig & (~1));
9434 orig_conv.is_owned = (orig & 1) || (orig == 0);
9435 LDKChannelAnnouncement ret = ChannelAnnouncement_clone(&orig_conv);
9436 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9439 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9440 LDKChannelAnnouncement this_ptr_conv;
9441 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9442 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9443 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9444 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_1(&this_ptr_conv).compact_form);
9448 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9449 LDKChannelAnnouncement this_ptr_conv;
9450 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9451 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9452 LDKSignature val_ref;
9453 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9454 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9455 ChannelAnnouncement_set_node_signature_1(&this_ptr_conv, val_ref);
9458 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9459 LDKChannelAnnouncement this_ptr_conv;
9460 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9461 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9462 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9463 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_node_signature_2(&this_ptr_conv).compact_form);
9467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9468 LDKChannelAnnouncement this_ptr_conv;
9469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9471 LDKSignature val_ref;
9472 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9473 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9474 ChannelAnnouncement_set_node_signature_2(&this_ptr_conv, val_ref);
9477 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
9478 LDKChannelAnnouncement this_ptr_conv;
9479 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9480 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9481 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9482 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_1(&this_ptr_conv).compact_form);
9486 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9487 LDKChannelAnnouncement this_ptr_conv;
9488 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9489 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9490 LDKSignature val_ref;
9491 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9492 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9493 ChannelAnnouncement_set_bitcoin_signature_1(&this_ptr_conv, val_ref);
9496 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
9497 LDKChannelAnnouncement this_ptr_conv;
9498 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9499 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9500 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9501 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelAnnouncement_get_bitcoin_signature_2(&this_ptr_conv).compact_form);
9505 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9506 LDKChannelAnnouncement this_ptr_conv;
9507 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9508 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9509 LDKSignature val_ref;
9510 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9511 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9512 ChannelAnnouncement_set_bitcoin_signature_2(&this_ptr_conv, val_ref);
9515 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9516 LDKChannelAnnouncement this_ptr_conv;
9517 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9518 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9519 LDKUnsignedChannelAnnouncement ret = ChannelAnnouncement_get_contents(&this_ptr_conv);
9520 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9523 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9524 LDKChannelAnnouncement this_ptr_conv;
9525 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9526 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9527 LDKUnsignedChannelAnnouncement val_conv;
9528 val_conv.inner = (void*)(val & (~1));
9529 val_conv.is_owned = (val & 1) || (val == 0);
9530 if (val_conv.inner != NULL)
9531 val_conv = UnsignedChannelAnnouncement_clone(&val_conv);
9532 ChannelAnnouncement_set_contents(&this_ptr_conv, val_conv);
9535 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) {
9536 LDKSignature node_signature_1_arg_ref;
9537 CHECK((*_env)->GetArrayLength (_env, node_signature_1_arg) == 64);
9538 (*_env)->GetByteArrayRegion (_env, node_signature_1_arg, 0, 64, node_signature_1_arg_ref.compact_form);
9539 LDKSignature node_signature_2_arg_ref;
9540 CHECK((*_env)->GetArrayLength (_env, node_signature_2_arg) == 64);
9541 (*_env)->GetByteArrayRegion (_env, node_signature_2_arg, 0, 64, node_signature_2_arg_ref.compact_form);
9542 LDKSignature bitcoin_signature_1_arg_ref;
9543 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_1_arg) == 64);
9544 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_1_arg, 0, 64, bitcoin_signature_1_arg_ref.compact_form);
9545 LDKSignature bitcoin_signature_2_arg_ref;
9546 CHECK((*_env)->GetArrayLength (_env, bitcoin_signature_2_arg) == 64);
9547 (*_env)->GetByteArrayRegion (_env, bitcoin_signature_2_arg, 0, 64, bitcoin_signature_2_arg_ref.compact_form);
9548 LDKUnsignedChannelAnnouncement contents_arg_conv;
9549 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9550 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9551 if (contents_arg_conv.inner != NULL)
9552 contents_arg_conv = UnsignedChannelAnnouncement_clone(&contents_arg_conv);
9553 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);
9554 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9558 LDKUnsignedChannelUpdate this_ptr_conv;
9559 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9560 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9561 UnsignedChannelUpdate_free(this_ptr_conv);
9564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9565 LDKUnsignedChannelUpdate orig_conv;
9566 orig_conv.inner = (void*)(orig & (~1));
9567 orig_conv.is_owned = (orig & 1) || (orig == 0);
9568 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_clone(&orig_conv);
9569 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9573 LDKUnsignedChannelUpdate this_ptr_conv;
9574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9576 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9577 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(&this_ptr_conv));
9581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9582 LDKUnsignedChannelUpdate this_ptr_conv;
9583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9585 LDKThirtyTwoBytes val_ref;
9586 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9587 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9588 UnsignedChannelUpdate_set_chain_hash(&this_ptr_conv, val_ref);
9591 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
9592 LDKUnsignedChannelUpdate this_ptr_conv;
9593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9595 jlong ret_val = UnsignedChannelUpdate_get_short_channel_id(&this_ptr_conv);
9599 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9600 LDKUnsignedChannelUpdate this_ptr_conv;
9601 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9602 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9603 UnsignedChannelUpdate_set_short_channel_id(&this_ptr_conv, val);
9606 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
9607 LDKUnsignedChannelUpdate this_ptr_conv;
9608 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9609 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9610 jint ret_val = UnsignedChannelUpdate_get_timestamp(&this_ptr_conv);
9614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9615 LDKUnsignedChannelUpdate this_ptr_conv;
9616 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9617 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9618 UnsignedChannelUpdate_set_timestamp(&this_ptr_conv, val);
9621 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
9622 LDKUnsignedChannelUpdate this_ptr_conv;
9623 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9624 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9625 jbyte ret_val = UnsignedChannelUpdate_get_flags(&this_ptr_conv);
9629 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
9630 LDKUnsignedChannelUpdate this_ptr_conv;
9631 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9632 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9633 UnsignedChannelUpdate_set_flags(&this_ptr_conv, val);
9636 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
9637 LDKUnsignedChannelUpdate this_ptr_conv;
9638 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9639 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9640 jshort ret_val = UnsignedChannelUpdate_get_cltv_expiry_delta(&this_ptr_conv);
9644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
9645 LDKUnsignedChannelUpdate this_ptr_conv;
9646 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9647 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9648 UnsignedChannelUpdate_set_cltv_expiry_delta(&this_ptr_conv, val);
9651 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9652 LDKUnsignedChannelUpdate this_ptr_conv;
9653 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9654 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9655 jlong ret_val = UnsignedChannelUpdate_get_htlc_minimum_msat(&this_ptr_conv);
9659 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9660 LDKUnsignedChannelUpdate this_ptr_conv;
9661 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9662 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9663 UnsignedChannelUpdate_set_htlc_minimum_msat(&this_ptr_conv, val);
9666 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
9667 LDKUnsignedChannelUpdate this_ptr_conv;
9668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9670 jint ret_val = UnsignedChannelUpdate_get_fee_base_msat(&this_ptr_conv);
9674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9675 LDKUnsignedChannelUpdate this_ptr_conv;
9676 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9677 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9678 UnsignedChannelUpdate_set_fee_base_msat(&this_ptr_conv, val);
9681 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
9682 LDKUnsignedChannelUpdate this_ptr_conv;
9683 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9684 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9685 jint ret_val = UnsignedChannelUpdate_get_fee_proportional_millionths(&this_ptr_conv);
9689 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9690 LDKUnsignedChannelUpdate this_ptr_conv;
9691 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9692 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9693 UnsignedChannelUpdate_set_fee_proportional_millionths(&this_ptr_conv, val);
9696 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9697 LDKChannelUpdate this_ptr_conv;
9698 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9699 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9700 ChannelUpdate_free(this_ptr_conv);
9703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9704 LDKChannelUpdate orig_conv;
9705 orig_conv.inner = (void*)(orig & (~1));
9706 orig_conv.is_owned = (orig & 1) || (orig == 0);
9707 LDKChannelUpdate ret = ChannelUpdate_clone(&orig_conv);
9708 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9711 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
9712 LDKChannelUpdate this_ptr_conv;
9713 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9714 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9715 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
9716 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, ChannelUpdate_get_signature(&this_ptr_conv).compact_form);
9720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9721 LDKChannelUpdate this_ptr_conv;
9722 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9723 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9724 LDKSignature val_ref;
9725 CHECK((*_env)->GetArrayLength (_env, val) == 64);
9726 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
9727 ChannelUpdate_set_signature(&this_ptr_conv, val_ref);
9730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
9731 LDKChannelUpdate this_ptr_conv;
9732 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9733 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9734 LDKUnsignedChannelUpdate ret = ChannelUpdate_get_contents(&this_ptr_conv);
9735 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
9739 LDKChannelUpdate this_ptr_conv;
9740 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9741 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9742 LDKUnsignedChannelUpdate val_conv;
9743 val_conv.inner = (void*)(val & (~1));
9744 val_conv.is_owned = (val & 1) || (val == 0);
9745 if (val_conv.inner != NULL)
9746 val_conv = UnsignedChannelUpdate_clone(&val_conv);
9747 ChannelUpdate_set_contents(&this_ptr_conv, val_conv);
9750 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jbyteArray signature_arg, jlong contents_arg) {
9751 LDKSignature signature_arg_ref;
9752 CHECK((*_env)->GetArrayLength (_env, signature_arg) == 64);
9753 (*_env)->GetByteArrayRegion (_env, signature_arg, 0, 64, signature_arg_ref.compact_form);
9754 LDKUnsignedChannelUpdate contents_arg_conv;
9755 contents_arg_conv.inner = (void*)(contents_arg & (~1));
9756 contents_arg_conv.is_owned = (contents_arg & 1) || (contents_arg == 0);
9757 if (contents_arg_conv.inner != NULL)
9758 contents_arg_conv = UnsignedChannelUpdate_clone(&contents_arg_conv);
9759 LDKChannelUpdate ret = ChannelUpdate_new(signature_arg_ref, contents_arg_conv);
9760 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9764 LDKQueryChannelRange this_ptr_conv;
9765 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9766 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9767 QueryChannelRange_free(this_ptr_conv);
9770 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9771 LDKQueryChannelRange orig_conv;
9772 orig_conv.inner = (void*)(orig & (~1));
9773 orig_conv.is_owned = (orig & 1) || (orig == 0);
9774 LDKQueryChannelRange ret = QueryChannelRange_clone(&orig_conv);
9775 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9778 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9779 LDKQueryChannelRange this_ptr_conv;
9780 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9781 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9782 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9783 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryChannelRange_get_chain_hash(&this_ptr_conv));
9787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9788 LDKQueryChannelRange this_ptr_conv;
9789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9791 LDKThirtyTwoBytes val_ref;
9792 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9793 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9794 QueryChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9797 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9798 LDKQueryChannelRange this_ptr_conv;
9799 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9800 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9801 jint ret_val = QueryChannelRange_get_first_blocknum(&this_ptr_conv);
9805 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9806 LDKQueryChannelRange this_ptr_conv;
9807 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9808 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9809 QueryChannelRange_set_first_blocknum(&this_ptr_conv, val);
9812 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9813 LDKQueryChannelRange this_ptr_conv;
9814 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9815 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9816 jint ret_val = QueryChannelRange_get_number_of_blocks(&this_ptr_conv);
9820 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9821 LDKQueryChannelRange this_ptr_conv;
9822 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9823 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9824 QueryChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9827 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) {
9828 LDKThirtyTwoBytes chain_hash_arg_ref;
9829 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9830 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9831 LDKQueryChannelRange ret = QueryChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg);
9832 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9835 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9836 LDKReplyChannelRange this_ptr_conv;
9837 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9838 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9839 ReplyChannelRange_free(this_ptr_conv);
9842 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9843 LDKReplyChannelRange orig_conv;
9844 orig_conv.inner = (void*)(orig & (~1));
9845 orig_conv.is_owned = (orig & 1) || (orig == 0);
9846 LDKReplyChannelRange ret = ReplyChannelRange_clone(&orig_conv);
9847 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9850 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9851 LDKReplyChannelRange this_ptr_conv;
9852 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9853 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9854 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9855 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyChannelRange_get_chain_hash(&this_ptr_conv));
9859 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9860 LDKReplyChannelRange this_ptr_conv;
9861 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9862 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9863 LDKThirtyTwoBytes val_ref;
9864 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9865 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9866 ReplyChannelRange_set_chain_hash(&this_ptr_conv, val_ref);
9869 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr) {
9870 LDKReplyChannelRange this_ptr_conv;
9871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9873 jint ret_val = ReplyChannelRange_get_first_blocknum(&this_ptr_conv);
9877 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1first_1blocknum(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9878 LDKReplyChannelRange this_ptr_conv;
9879 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9880 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9881 ReplyChannelRange_set_first_blocknum(&this_ptr_conv, val);
9884 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr) {
9885 LDKReplyChannelRange this_ptr_conv;
9886 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9887 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9888 jint ret_val = ReplyChannelRange_get_number_of_blocks(&this_ptr_conv);
9892 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1number_1of_1blocks(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
9893 LDKReplyChannelRange this_ptr_conv;
9894 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9895 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9896 ReplyChannelRange_set_number_of_blocks(&this_ptr_conv, val);
9899 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
9900 LDKReplyChannelRange this_ptr_conv;
9901 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9902 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9903 jboolean ret_val = ReplyChannelRange_get_full_information(&this_ptr_conv);
9907 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
9908 LDKReplyChannelRange this_ptr_conv;
9909 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9910 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9911 ReplyChannelRange_set_full_information(&this_ptr_conv, val);
9914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9915 LDKReplyChannelRange this_ptr_conv;
9916 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9917 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9918 LDKCVec_u64Z val_constr;
9919 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9920 if (val_constr.datalen > 0)
9921 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9923 val_constr.data = NULL;
9924 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9925 for (size_t g = 0; g < val_constr.datalen; g++) {
9926 long arr_conv_6 = val_vals[g];
9927 val_constr.data[g] = arr_conv_6;
9929 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
9930 ReplyChannelRange_set_short_channel_ids(&this_ptr_conv, val_constr);
9933 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, jlongArray short_channel_ids_arg) {
9934 LDKThirtyTwoBytes chain_hash_arg_ref;
9935 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
9936 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
9937 LDKCVec_u64Z short_channel_ids_arg_constr;
9938 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
9939 if (short_channel_ids_arg_constr.datalen > 0)
9940 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9942 short_channel_ids_arg_constr.data = NULL;
9943 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
9944 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
9945 long arr_conv_6 = short_channel_ids_arg_vals[g];
9946 short_channel_ids_arg_constr.data[g] = arr_conv_6;
9948 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
9949 LDKReplyChannelRange ret = ReplyChannelRange_new(chain_hash_arg_ref, first_blocknum_arg, number_of_blocks_arg, full_information_arg, short_channel_ids_arg_constr);
9950 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9953 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
9954 LDKQueryShortChannelIds this_ptr_conv;
9955 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9956 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9957 QueryShortChannelIds_free(this_ptr_conv);
9960 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1clone(JNIEnv * _env, jclass _b, jlong orig) {
9961 LDKQueryShortChannelIds orig_conv;
9962 orig_conv.inner = (void*)(orig & (~1));
9963 orig_conv.is_owned = (orig & 1) || (orig == 0);
9964 LDKQueryShortChannelIds ret = QueryShortChannelIds_clone(&orig_conv);
9965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
9968 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
9969 LDKQueryShortChannelIds this_ptr_conv;
9970 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9971 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9972 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
9973 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *QueryShortChannelIds_get_chain_hash(&this_ptr_conv));
9977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
9978 LDKQueryShortChannelIds this_ptr_conv;
9979 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9980 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9981 LDKThirtyTwoBytes val_ref;
9982 CHECK((*_env)->GetArrayLength (_env, val) == 32);
9983 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
9984 QueryShortChannelIds_set_chain_hash(&this_ptr_conv, val_ref);
9987 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1set_1short_1channel_1ids(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
9988 LDKQueryShortChannelIds this_ptr_conv;
9989 this_ptr_conv.inner = (void*)(this_ptr & (~1));
9990 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
9991 LDKCVec_u64Z val_constr;
9992 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
9993 if (val_constr.datalen > 0)
9994 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
9996 val_constr.data = NULL;
9997 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
9998 for (size_t g = 0; g < val_constr.datalen; g++) {
9999 long arr_conv_6 = val_vals[g];
10000 val_constr.data[g] = arr_conv_6;
10002 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10003 QueryShortChannelIds_set_short_channel_ids(&this_ptr_conv, val_constr);
10006 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jlongArray short_channel_ids_arg) {
10007 LDKThirtyTwoBytes chain_hash_arg_ref;
10008 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10009 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10010 LDKCVec_u64Z short_channel_ids_arg_constr;
10011 short_channel_ids_arg_constr.datalen = (*_env)->GetArrayLength (_env, short_channel_ids_arg);
10012 if (short_channel_ids_arg_constr.datalen > 0)
10013 short_channel_ids_arg_constr.data = MALLOC(short_channel_ids_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
10015 short_channel_ids_arg_constr.data = NULL;
10016 long* short_channel_ids_arg_vals = (*_env)->GetLongArrayElements (_env, short_channel_ids_arg, NULL);
10017 for (size_t g = 0; g < short_channel_ids_arg_constr.datalen; g++) {
10018 long arr_conv_6 = short_channel_ids_arg_vals[g];
10019 short_channel_ids_arg_constr.data[g] = arr_conv_6;
10021 (*_env)->ReleaseLongArrayElements (_env, short_channel_ids_arg, short_channel_ids_arg_vals, 0);
10022 LDKQueryShortChannelIds ret = QueryShortChannelIds_new(chain_hash_arg_ref, short_channel_ids_arg_constr);
10023 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10026 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10027 LDKReplyShortChannelIdsEnd this_ptr_conv;
10028 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10029 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10030 ReplyShortChannelIdsEnd_free(this_ptr_conv);
10033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10034 LDKReplyShortChannelIdsEnd orig_conv;
10035 orig_conv.inner = (void*)(orig & (~1));
10036 orig_conv.is_owned = (orig & 1) || (orig == 0);
10037 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_clone(&orig_conv);
10038 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10041 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10042 LDKReplyShortChannelIdsEnd this_ptr_conv;
10043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10045 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10046 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ReplyShortChannelIdsEnd_get_chain_hash(&this_ptr_conv));
10050 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10051 LDKReplyShortChannelIdsEnd this_ptr_conv;
10052 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10053 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10054 LDKThirtyTwoBytes val_ref;
10055 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10056 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10057 ReplyShortChannelIdsEnd_set_chain_hash(&this_ptr_conv, val_ref);
10060 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1get_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr) {
10061 LDKReplyShortChannelIdsEnd this_ptr_conv;
10062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10064 jboolean ret_val = ReplyShortChannelIdsEnd_get_full_information(&this_ptr_conv);
10068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1set_1full_1information(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
10069 LDKReplyShortChannelIdsEnd this_ptr_conv;
10070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10072 ReplyShortChannelIdsEnd_set_full_information(&this_ptr_conv, val);
10075 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1new(JNIEnv * _env, jclass _b, jbyteArray chain_hash_arg, jboolean full_information_arg) {
10076 LDKThirtyTwoBytes chain_hash_arg_ref;
10077 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10078 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10079 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_new(chain_hash_arg_ref, full_information_arg);
10080 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10084 LDKGossipTimestampFilter this_ptr_conv;
10085 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10086 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10087 GossipTimestampFilter_free(this_ptr_conv);
10090 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10091 LDKGossipTimestampFilter orig_conv;
10092 orig_conv.inner = (void*)(orig & (~1));
10093 orig_conv.is_owned = (orig & 1) || (orig == 0);
10094 LDKGossipTimestampFilter ret = GossipTimestampFilter_clone(&orig_conv);
10095 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10098 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
10099 LDKGossipTimestampFilter this_ptr_conv;
10100 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10101 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10102 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
10103 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *GossipTimestampFilter_get_chain_hash(&this_ptr_conv));
10107 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10108 LDKGossipTimestampFilter this_ptr_conv;
10109 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10110 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10111 LDKThirtyTwoBytes val_ref;
10112 CHECK((*_env)->GetArrayLength (_env, val) == 32);
10113 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
10114 GossipTimestampFilter_set_chain_hash(&this_ptr_conv, val_ref);
10117 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
10118 LDKGossipTimestampFilter this_ptr_conv;
10119 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10120 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10121 jint ret_val = GossipTimestampFilter_get_first_timestamp(&this_ptr_conv);
10125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1first_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10126 LDKGossipTimestampFilter this_ptr_conv;
10127 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10128 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10129 GossipTimestampFilter_set_first_timestamp(&this_ptr_conv, val);
10132 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1get_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr) {
10133 LDKGossipTimestampFilter this_ptr_conv;
10134 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10135 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10136 jint ret_val = GossipTimestampFilter_get_timestamp_range(&this_ptr_conv);
10140 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1set_1timestamp_1range(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
10141 LDKGossipTimestampFilter this_ptr_conv;
10142 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10143 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10144 GossipTimestampFilter_set_timestamp_range(&this_ptr_conv, val);
10147 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) {
10148 LDKThirtyTwoBytes chain_hash_arg_ref;
10149 CHECK((*_env)->GetArrayLength (_env, chain_hash_arg) == 32);
10150 (*_env)->GetByteArrayRegion (_env, chain_hash_arg, 0, 32, chain_hash_arg_ref.data);
10151 LDKGossipTimestampFilter ret = GossipTimestampFilter_new(chain_hash_arg_ref, first_timestamp_arg, timestamp_range_arg);
10152 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10155 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10156 LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
10157 FREE((void*)this_ptr);
10158 ErrorAction_free(this_ptr_conv);
10161 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10162 LDKLightningError this_ptr_conv;
10163 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10164 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10165 LightningError_free(this_ptr_conv);
10168 JNIEXPORT jstring JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
10169 LDKLightningError this_ptr_conv;
10170 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10171 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10172 LDKStr _str = LightningError_get_err(&this_ptr_conv);
10173 char* _buf = MALLOC(_str.len + 1, "str conv buf");
10174 memcpy(_buf, _str.chars, _str.len);
10175 _buf[_str.len] = 0;
10176 jstring _conv = (*_env)->NewStringUTF(_env, _str.chars);
10181 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
10182 LDKLightningError this_ptr_conv;
10183 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10184 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10185 LDKCVec_u8Z val_ref;
10186 val_ref.data = (*_env)->GetByteArrayElements (_env, val, NULL);
10187 val_ref.datalen = (*_env)->GetArrayLength (_env, val);
10188 LightningError_set_err(&this_ptr_conv, val_ref);
10189 (*_env)->ReleaseByteArrayElements(_env, val, (int8_t*)val_ref.data, 0);
10192 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
10193 LDKLightningError this_ptr_conv;
10194 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10195 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10196 LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
10197 *ret = LightningError_get_action(&this_ptr_conv);
10201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10202 LDKLightningError this_ptr_conv;
10203 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10204 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10205 LDKErrorAction val_conv = *(LDKErrorAction*)val;
10207 LightningError_set_action(&this_ptr_conv, val_conv);
10210 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jbyteArray err_arg, jlong action_arg) {
10211 LDKCVec_u8Z err_arg_ref;
10212 err_arg_ref.data = (*_env)->GetByteArrayElements (_env, err_arg, NULL);
10213 err_arg_ref.datalen = (*_env)->GetArrayLength (_env, err_arg);
10214 LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
10215 FREE((void*)action_arg);
10216 LDKLightningError ret = LightningError_new(err_arg_ref, action_arg_conv);
10217 (*_env)->ReleaseByteArrayElements(_env, err_arg, (int8_t*)err_arg_ref.data, 0);
10218 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10221 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10222 LDKCommitmentUpdate this_ptr_conv;
10223 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10224 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10225 CommitmentUpdate_free(this_ptr_conv);
10228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1clone(JNIEnv * _env, jclass _b, jlong orig) {
10229 LDKCommitmentUpdate orig_conv;
10230 orig_conv.inner = (void*)(orig & (~1));
10231 orig_conv.is_owned = (orig & 1) || (orig == 0);
10232 LDKCommitmentUpdate ret = CommitmentUpdate_clone(&orig_conv);
10233 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10236 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10237 LDKCommitmentUpdate this_ptr_conv;
10238 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10239 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10240 LDKCVec_UpdateAddHTLCZ val_constr;
10241 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10242 if (val_constr.datalen > 0)
10243 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10245 val_constr.data = NULL;
10246 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10247 for (size_t p = 0; p < val_constr.datalen; p++) {
10248 long arr_conv_15 = val_vals[p];
10249 LDKUpdateAddHTLC arr_conv_15_conv;
10250 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10251 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10252 if (arr_conv_15_conv.inner != NULL)
10253 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10254 val_constr.data[p] = arr_conv_15_conv;
10256 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10257 CommitmentUpdate_set_update_add_htlcs(&this_ptr_conv, val_constr);
10260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10261 LDKCommitmentUpdate this_ptr_conv;
10262 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10263 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10264 LDKCVec_UpdateFulfillHTLCZ val_constr;
10265 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10266 if (val_constr.datalen > 0)
10267 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10269 val_constr.data = NULL;
10270 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10271 for (size_t t = 0; t < val_constr.datalen; t++) {
10272 long arr_conv_19 = val_vals[t];
10273 LDKUpdateFulfillHTLC arr_conv_19_conv;
10274 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10275 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10276 if (arr_conv_19_conv.inner != NULL)
10277 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10278 val_constr.data[t] = arr_conv_19_conv;
10280 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10281 CommitmentUpdate_set_update_fulfill_htlcs(&this_ptr_conv, val_constr);
10284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10285 LDKCommitmentUpdate this_ptr_conv;
10286 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10287 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10288 LDKCVec_UpdateFailHTLCZ val_constr;
10289 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10290 if (val_constr.datalen > 0)
10291 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10293 val_constr.data = NULL;
10294 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10295 for (size_t q = 0; q < val_constr.datalen; q++) {
10296 long arr_conv_16 = val_vals[q];
10297 LDKUpdateFailHTLC arr_conv_16_conv;
10298 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10299 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10300 if (arr_conv_16_conv.inner != NULL)
10301 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10302 val_constr.data[q] = arr_conv_16_conv;
10304 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10305 CommitmentUpdate_set_update_fail_htlcs(&this_ptr_conv, val_constr);
10308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
10309 LDKCommitmentUpdate this_ptr_conv;
10310 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10311 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10312 LDKCVec_UpdateFailMalformedHTLCZ val_constr;
10313 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
10314 if (val_constr.datalen > 0)
10315 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10317 val_constr.data = NULL;
10318 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
10319 for (size_t z = 0; z < val_constr.datalen; z++) {
10320 long arr_conv_25 = val_vals[z];
10321 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10322 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10323 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10324 if (arr_conv_25_conv.inner != NULL)
10325 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10326 val_constr.data[z] = arr_conv_25_conv;
10328 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
10329 CommitmentUpdate_set_update_fail_malformed_htlcs(&this_ptr_conv, val_constr);
10332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
10333 LDKCommitmentUpdate this_ptr_conv;
10334 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10335 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10336 LDKUpdateFee ret = CommitmentUpdate_get_update_fee(&this_ptr_conv);
10337 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10340 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10341 LDKCommitmentUpdate this_ptr_conv;
10342 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10343 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10344 LDKUpdateFee val_conv;
10345 val_conv.inner = (void*)(val & (~1));
10346 val_conv.is_owned = (val & 1) || (val == 0);
10347 if (val_conv.inner != NULL)
10348 val_conv = UpdateFee_clone(&val_conv);
10349 CommitmentUpdate_set_update_fee(&this_ptr_conv, val_conv);
10352 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
10353 LDKCommitmentUpdate this_ptr_conv;
10354 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10355 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10356 LDKCommitmentSigned ret = CommitmentUpdate_get_commitment_signed(&this_ptr_conv);
10357 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
10361 LDKCommitmentUpdate this_ptr_conv;
10362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
10363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
10364 LDKCommitmentSigned val_conv;
10365 val_conv.inner = (void*)(val & (~1));
10366 val_conv.is_owned = (val & 1) || (val == 0);
10367 if (val_conv.inner != NULL)
10368 val_conv = CommitmentSigned_clone(&val_conv);
10369 CommitmentUpdate_set_commitment_signed(&this_ptr_conv, val_conv);
10372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv * _env, jclass _b, jlongArray update_add_htlcs_arg, jlongArray update_fulfill_htlcs_arg, jlongArray update_fail_htlcs_arg, jlongArray update_fail_malformed_htlcs_arg, jlong update_fee_arg, jlong commitment_signed_arg) {
10373 LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_constr;
10374 update_add_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_add_htlcs_arg);
10375 if (update_add_htlcs_arg_constr.datalen > 0)
10376 update_add_htlcs_arg_constr.data = MALLOC(update_add_htlcs_arg_constr.datalen * sizeof(LDKUpdateAddHTLC), "LDKCVec_UpdateAddHTLCZ Elements");
10378 update_add_htlcs_arg_constr.data = NULL;
10379 long* update_add_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_add_htlcs_arg, NULL);
10380 for (size_t p = 0; p < update_add_htlcs_arg_constr.datalen; p++) {
10381 long arr_conv_15 = update_add_htlcs_arg_vals[p];
10382 LDKUpdateAddHTLC arr_conv_15_conv;
10383 arr_conv_15_conv.inner = (void*)(arr_conv_15 & (~1));
10384 arr_conv_15_conv.is_owned = (arr_conv_15 & 1) || (arr_conv_15 == 0);
10385 if (arr_conv_15_conv.inner != NULL)
10386 arr_conv_15_conv = UpdateAddHTLC_clone(&arr_conv_15_conv);
10387 update_add_htlcs_arg_constr.data[p] = arr_conv_15_conv;
10389 (*_env)->ReleaseLongArrayElements (_env, update_add_htlcs_arg, update_add_htlcs_arg_vals, 0);
10390 LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_constr;
10391 update_fulfill_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fulfill_htlcs_arg);
10392 if (update_fulfill_htlcs_arg_constr.datalen > 0)
10393 update_fulfill_htlcs_arg_constr.data = MALLOC(update_fulfill_htlcs_arg_constr.datalen * sizeof(LDKUpdateFulfillHTLC), "LDKCVec_UpdateFulfillHTLCZ Elements");
10395 update_fulfill_htlcs_arg_constr.data = NULL;
10396 long* update_fulfill_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fulfill_htlcs_arg, NULL);
10397 for (size_t t = 0; t < update_fulfill_htlcs_arg_constr.datalen; t++) {
10398 long arr_conv_19 = update_fulfill_htlcs_arg_vals[t];
10399 LDKUpdateFulfillHTLC arr_conv_19_conv;
10400 arr_conv_19_conv.inner = (void*)(arr_conv_19 & (~1));
10401 arr_conv_19_conv.is_owned = (arr_conv_19 & 1) || (arr_conv_19 == 0);
10402 if (arr_conv_19_conv.inner != NULL)
10403 arr_conv_19_conv = UpdateFulfillHTLC_clone(&arr_conv_19_conv);
10404 update_fulfill_htlcs_arg_constr.data[t] = arr_conv_19_conv;
10406 (*_env)->ReleaseLongArrayElements (_env, update_fulfill_htlcs_arg, update_fulfill_htlcs_arg_vals, 0);
10407 LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_constr;
10408 update_fail_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_htlcs_arg);
10409 if (update_fail_htlcs_arg_constr.datalen > 0)
10410 update_fail_htlcs_arg_constr.data = MALLOC(update_fail_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailHTLC), "LDKCVec_UpdateFailHTLCZ Elements");
10412 update_fail_htlcs_arg_constr.data = NULL;
10413 long* update_fail_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_htlcs_arg, NULL);
10414 for (size_t q = 0; q < update_fail_htlcs_arg_constr.datalen; q++) {
10415 long arr_conv_16 = update_fail_htlcs_arg_vals[q];
10416 LDKUpdateFailHTLC arr_conv_16_conv;
10417 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
10418 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
10419 if (arr_conv_16_conv.inner != NULL)
10420 arr_conv_16_conv = UpdateFailHTLC_clone(&arr_conv_16_conv);
10421 update_fail_htlcs_arg_constr.data[q] = arr_conv_16_conv;
10423 (*_env)->ReleaseLongArrayElements (_env, update_fail_htlcs_arg, update_fail_htlcs_arg_vals, 0);
10424 LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_constr;
10425 update_fail_malformed_htlcs_arg_constr.datalen = (*_env)->GetArrayLength (_env, update_fail_malformed_htlcs_arg);
10426 if (update_fail_malformed_htlcs_arg_constr.datalen > 0)
10427 update_fail_malformed_htlcs_arg_constr.data = MALLOC(update_fail_malformed_htlcs_arg_constr.datalen * sizeof(LDKUpdateFailMalformedHTLC), "LDKCVec_UpdateFailMalformedHTLCZ Elements");
10429 update_fail_malformed_htlcs_arg_constr.data = NULL;
10430 long* update_fail_malformed_htlcs_arg_vals = (*_env)->GetLongArrayElements (_env, update_fail_malformed_htlcs_arg, NULL);
10431 for (size_t z = 0; z < update_fail_malformed_htlcs_arg_constr.datalen; z++) {
10432 long arr_conv_25 = update_fail_malformed_htlcs_arg_vals[z];
10433 LDKUpdateFailMalformedHTLC arr_conv_25_conv;
10434 arr_conv_25_conv.inner = (void*)(arr_conv_25 & (~1));
10435 arr_conv_25_conv.is_owned = (arr_conv_25 & 1) || (arr_conv_25 == 0);
10436 if (arr_conv_25_conv.inner != NULL)
10437 arr_conv_25_conv = UpdateFailMalformedHTLC_clone(&arr_conv_25_conv);
10438 update_fail_malformed_htlcs_arg_constr.data[z] = arr_conv_25_conv;
10440 (*_env)->ReleaseLongArrayElements (_env, update_fail_malformed_htlcs_arg, update_fail_malformed_htlcs_arg_vals, 0);
10441 LDKUpdateFee update_fee_arg_conv;
10442 update_fee_arg_conv.inner = (void*)(update_fee_arg & (~1));
10443 update_fee_arg_conv.is_owned = (update_fee_arg & 1) || (update_fee_arg == 0);
10444 if (update_fee_arg_conv.inner != NULL)
10445 update_fee_arg_conv = UpdateFee_clone(&update_fee_arg_conv);
10446 LDKCommitmentSigned commitment_signed_arg_conv;
10447 commitment_signed_arg_conv.inner = (void*)(commitment_signed_arg & (~1));
10448 commitment_signed_arg_conv.is_owned = (commitment_signed_arg & 1) || (commitment_signed_arg == 0);
10449 if (commitment_signed_arg_conv.inner != NULL)
10450 commitment_signed_arg_conv = CommitmentSigned_clone(&commitment_signed_arg_conv);
10451 LDKCommitmentUpdate ret = CommitmentUpdate_new(update_add_htlcs_arg_constr, update_fulfill_htlcs_arg_constr, update_fail_htlcs_arg_constr, update_fail_malformed_htlcs_arg_constr, update_fee_arg_conv, commitment_signed_arg_conv);
10452 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10455 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10456 LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
10457 FREE((void*)this_ptr);
10458 HTLCFailChannelUpdate_free(this_ptr_conv);
10461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10462 LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
10463 FREE((void*)this_ptr);
10464 ChannelMessageHandler_free(this_ptr_conv);
10467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
10468 LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
10469 FREE((void*)this_ptr);
10470 RoutingMessageHandler_free(this_ptr_conv);
10473 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10474 LDKAcceptChannel obj_conv;
10475 obj_conv.inner = (void*)(obj & (~1));
10476 obj_conv.is_owned = (obj & 1) || (obj == 0);
10477 LDKCVec_u8Z arg_var = AcceptChannel_write(&obj_conv);
10478 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10479 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10483 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10484 LDKu8slice ser_ref;
10485 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10486 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10487 LDKAcceptChannel ret = AcceptChannel_read(ser_ref);
10488 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10489 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10492 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
10493 LDKAnnouncementSignatures obj_conv;
10494 obj_conv.inner = (void*)(obj & (~1));
10495 obj_conv.is_owned = (obj & 1) || (obj == 0);
10496 LDKCVec_u8Z arg_var = AnnouncementSignatures_write(&obj_conv);
10497 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10498 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10503 LDKu8slice ser_ref;
10504 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10505 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10506 LDKAnnouncementSignatures ret = AnnouncementSignatures_read(ser_ref);
10507 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10508 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10511 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
10512 LDKChannelReestablish obj_conv;
10513 obj_conv.inner = (void*)(obj & (~1));
10514 obj_conv.is_owned = (obj & 1) || (obj == 0);
10515 LDKCVec_u8Z arg_var = ChannelReestablish_write(&obj_conv);
10516 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10517 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10522 LDKu8slice ser_ref;
10523 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10524 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10525 LDKChannelReestablish ret = ChannelReestablish_read(ser_ref);
10526 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10527 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10530 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10531 LDKClosingSigned obj_conv;
10532 obj_conv.inner = (void*)(obj & (~1));
10533 obj_conv.is_owned = (obj & 1) || (obj == 0);
10534 LDKCVec_u8Z arg_var = ClosingSigned_write(&obj_conv);
10535 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10536 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10540 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10541 LDKu8slice ser_ref;
10542 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10543 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10544 LDKClosingSigned ret = ClosingSigned_read(ser_ref);
10545 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10546 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10549 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10550 LDKCommitmentSigned obj_conv;
10551 obj_conv.inner = (void*)(obj & (~1));
10552 obj_conv.is_owned = (obj & 1) || (obj == 0);
10553 LDKCVec_u8Z arg_var = CommitmentSigned_write(&obj_conv);
10554 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10555 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10559 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10560 LDKu8slice ser_ref;
10561 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10562 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10563 LDKCommitmentSigned ret = CommitmentSigned_read(ser_ref);
10564 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10565 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10568 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
10569 LDKFundingCreated obj_conv;
10570 obj_conv.inner = (void*)(obj & (~1));
10571 obj_conv.is_owned = (obj & 1) || (obj == 0);
10572 LDKCVec_u8Z arg_var = FundingCreated_write(&obj_conv);
10573 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10574 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10578 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10579 LDKu8slice ser_ref;
10580 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10581 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10582 LDKFundingCreated ret = FundingCreated_read(ser_ref);
10583 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10584 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10587 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
10588 LDKFundingSigned obj_conv;
10589 obj_conv.inner = (void*)(obj & (~1));
10590 obj_conv.is_owned = (obj & 1) || (obj == 0);
10591 LDKCVec_u8Z arg_var = FundingSigned_write(&obj_conv);
10592 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10593 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10597 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10598 LDKu8slice ser_ref;
10599 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10600 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10601 LDKFundingSigned ret = FundingSigned_read(ser_ref);
10602 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10603 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10606 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
10607 LDKFundingLocked obj_conv;
10608 obj_conv.inner = (void*)(obj & (~1));
10609 obj_conv.is_owned = (obj & 1) || (obj == 0);
10610 LDKCVec_u8Z arg_var = FundingLocked_write(&obj_conv);
10611 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10612 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10616 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10617 LDKu8slice ser_ref;
10618 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10619 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10620 LDKFundingLocked ret = FundingLocked_read(ser_ref);
10621 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10622 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10625 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
10627 obj_conv.inner = (void*)(obj & (~1));
10628 obj_conv.is_owned = (obj & 1) || (obj == 0);
10629 LDKCVec_u8Z arg_var = Init_write(&obj_conv);
10630 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10631 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10635 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10636 LDKu8slice ser_ref;
10637 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10638 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10639 LDKInit ret = Init_read(ser_ref);
10640 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10641 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10644 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
10645 LDKOpenChannel obj_conv;
10646 obj_conv.inner = (void*)(obj & (~1));
10647 obj_conv.is_owned = (obj & 1) || (obj == 0);
10648 LDKCVec_u8Z arg_var = OpenChannel_write(&obj_conv);
10649 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10650 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10654 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10655 LDKu8slice ser_ref;
10656 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10657 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10658 LDKOpenChannel ret = OpenChannel_read(ser_ref);
10659 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10660 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10663 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
10664 LDKRevokeAndACK obj_conv;
10665 obj_conv.inner = (void*)(obj & (~1));
10666 obj_conv.is_owned = (obj & 1) || (obj == 0);
10667 LDKCVec_u8Z arg_var = RevokeAndACK_write(&obj_conv);
10668 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10669 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10673 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10674 LDKu8slice ser_ref;
10675 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10676 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10677 LDKRevokeAndACK ret = RevokeAndACK_read(ser_ref);
10678 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10679 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10682 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
10683 LDKShutdown obj_conv;
10684 obj_conv.inner = (void*)(obj & (~1));
10685 obj_conv.is_owned = (obj & 1) || (obj == 0);
10686 LDKCVec_u8Z arg_var = Shutdown_write(&obj_conv);
10687 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10688 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10692 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10693 LDKu8slice ser_ref;
10694 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10695 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10696 LDKShutdown ret = Shutdown_read(ser_ref);
10697 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10698 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10701 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10702 LDKUpdateFailHTLC obj_conv;
10703 obj_conv.inner = (void*)(obj & (~1));
10704 obj_conv.is_owned = (obj & 1) || (obj == 0);
10705 LDKCVec_u8Z arg_var = UpdateFailHTLC_write(&obj_conv);
10706 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10707 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10711 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10712 LDKu8slice ser_ref;
10713 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10714 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10715 LDKUpdateFailHTLC ret = UpdateFailHTLC_read(ser_ref);
10716 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10717 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10720 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10721 LDKUpdateFailMalformedHTLC obj_conv;
10722 obj_conv.inner = (void*)(obj & (~1));
10723 obj_conv.is_owned = (obj & 1) || (obj == 0);
10724 LDKCVec_u8Z arg_var = UpdateFailMalformedHTLC_write(&obj_conv);
10725 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10726 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10730 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10731 LDKu8slice ser_ref;
10732 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10733 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10734 LDKUpdateFailMalformedHTLC ret = UpdateFailMalformedHTLC_read(ser_ref);
10735 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10736 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10739 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
10740 LDKUpdateFee obj_conv;
10741 obj_conv.inner = (void*)(obj & (~1));
10742 obj_conv.is_owned = (obj & 1) || (obj == 0);
10743 LDKCVec_u8Z arg_var = UpdateFee_write(&obj_conv);
10744 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10745 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10750 LDKu8slice ser_ref;
10751 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10752 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10753 LDKUpdateFee ret = UpdateFee_read(ser_ref);
10754 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10755 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10758 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10759 LDKUpdateFulfillHTLC obj_conv;
10760 obj_conv.inner = (void*)(obj & (~1));
10761 obj_conv.is_owned = (obj & 1) || (obj == 0);
10762 LDKCVec_u8Z arg_var = UpdateFulfillHTLC_write(&obj_conv);
10763 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10764 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10768 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10769 LDKu8slice ser_ref;
10770 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10771 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10772 LDKUpdateFulfillHTLC ret = UpdateFulfillHTLC_read(ser_ref);
10773 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10774 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10777 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
10778 LDKUpdateAddHTLC obj_conv;
10779 obj_conv.inner = (void*)(obj & (~1));
10780 obj_conv.is_owned = (obj & 1) || (obj == 0);
10781 LDKCVec_u8Z arg_var = UpdateAddHTLC_write(&obj_conv);
10782 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10783 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10787 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10788 LDKu8slice ser_ref;
10789 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10790 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10791 LDKUpdateAddHTLC ret = UpdateAddHTLC_read(ser_ref);
10792 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10793 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10796 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
10798 obj_conv.inner = (void*)(obj & (~1));
10799 obj_conv.is_owned = (obj & 1) || (obj == 0);
10800 LDKCVec_u8Z arg_var = Ping_write(&obj_conv);
10801 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10802 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10806 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10807 LDKu8slice ser_ref;
10808 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10809 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10810 LDKPing ret = Ping_read(ser_ref);
10811 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10812 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10815 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
10817 obj_conv.inner = (void*)(obj & (~1));
10818 obj_conv.is_owned = (obj & 1) || (obj == 0);
10819 LDKCVec_u8Z arg_var = Pong_write(&obj_conv);
10820 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10821 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10825 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10826 LDKu8slice ser_ref;
10827 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10828 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10829 LDKPong ret = Pong_read(ser_ref);
10830 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10831 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10834 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10835 LDKUnsignedChannelAnnouncement obj_conv;
10836 obj_conv.inner = (void*)(obj & (~1));
10837 obj_conv.is_owned = (obj & 1) || (obj == 0);
10838 LDKCVec_u8Z arg_var = UnsignedChannelAnnouncement_write(&obj_conv);
10839 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10840 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10845 LDKu8slice ser_ref;
10846 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10847 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10848 LDKUnsignedChannelAnnouncement ret = UnsignedChannelAnnouncement_read(ser_ref);
10849 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10850 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10853 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10854 LDKChannelAnnouncement obj_conv;
10855 obj_conv.inner = (void*)(obj & (~1));
10856 obj_conv.is_owned = (obj & 1) || (obj == 0);
10857 LDKCVec_u8Z arg_var = ChannelAnnouncement_write(&obj_conv);
10858 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10859 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10863 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10864 LDKu8slice ser_ref;
10865 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10866 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10867 LDKChannelAnnouncement ret = ChannelAnnouncement_read(ser_ref);
10868 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10869 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10872 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10873 LDKUnsignedChannelUpdate obj_conv;
10874 obj_conv.inner = (void*)(obj & (~1));
10875 obj_conv.is_owned = (obj & 1) || (obj == 0);
10876 LDKCVec_u8Z arg_var = UnsignedChannelUpdate_write(&obj_conv);
10877 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10878 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10882 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10883 LDKu8slice ser_ref;
10884 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10885 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10886 LDKUnsignedChannelUpdate ret = UnsignedChannelUpdate_read(ser_ref);
10887 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10888 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10891 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
10892 LDKChannelUpdate obj_conv;
10893 obj_conv.inner = (void*)(obj & (~1));
10894 obj_conv.is_owned = (obj & 1) || (obj == 0);
10895 LDKCVec_u8Z arg_var = ChannelUpdate_write(&obj_conv);
10896 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10897 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10902 LDKu8slice ser_ref;
10903 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10904 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10905 LDKChannelUpdate ret = ChannelUpdate_read(ser_ref);
10906 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10907 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10910 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
10911 LDKErrorMessage obj_conv;
10912 obj_conv.inner = (void*)(obj & (~1));
10913 obj_conv.is_owned = (obj & 1) || (obj == 0);
10914 LDKCVec_u8Z arg_var = ErrorMessage_write(&obj_conv);
10915 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10916 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10920 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10921 LDKu8slice ser_ref;
10922 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10923 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10924 LDKErrorMessage ret = ErrorMessage_read(ser_ref);
10925 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10926 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10929 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10930 LDKUnsignedNodeAnnouncement obj_conv;
10931 obj_conv.inner = (void*)(obj & (~1));
10932 obj_conv.is_owned = (obj & 1) || (obj == 0);
10933 LDKCVec_u8Z arg_var = UnsignedNodeAnnouncement_write(&obj_conv);
10934 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10935 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10940 LDKu8slice ser_ref;
10941 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10942 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10943 LDKUnsignedNodeAnnouncement ret = UnsignedNodeAnnouncement_read(ser_ref);
10944 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10945 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10948 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
10949 LDKNodeAnnouncement obj_conv;
10950 obj_conv.inner = (void*)(obj & (~1));
10951 obj_conv.is_owned = (obj & 1) || (obj == 0);
10952 LDKCVec_u8Z arg_var = NodeAnnouncement_write(&obj_conv);
10953 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10954 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10958 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10959 LDKu8slice ser_ref;
10960 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10961 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10962 LDKNodeAnnouncement ret = NodeAnnouncement_read(ser_ref);
10963 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10964 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10967 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10968 LDKu8slice ser_ref;
10969 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10970 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10971 LDKQueryShortChannelIds ret = QueryShortChannelIds_read(ser_ref);
10972 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10973 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10976 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryShortChannelIds_1write(JNIEnv * _env, jclass _b, jlong obj) {
10977 LDKQueryShortChannelIds obj_conv;
10978 obj_conv.inner = (void*)(obj & (~1));
10979 obj_conv.is_owned = (obj & 1) || (obj == 0);
10980 LDKCVec_u8Z arg_var = QueryShortChannelIds_write(&obj_conv);
10981 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
10982 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
10986 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
10987 LDKu8slice ser_ref;
10988 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
10989 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
10990 LDKReplyShortChannelIdsEnd ret = ReplyShortChannelIdsEnd_read(ser_ref);
10991 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
10992 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
10995 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyShortChannelIdsEnd_1write(JNIEnv * _env, jclass _b, jlong obj) {
10996 LDKReplyShortChannelIdsEnd obj_conv;
10997 obj_conv.inner = (void*)(obj & (~1));
10998 obj_conv.is_owned = (obj & 1) || (obj == 0);
10999 LDKCVec_u8Z arg_var = ReplyShortChannelIdsEnd_write(&obj_conv);
11000 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11001 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11006 LDKu8slice ser_ref;
11007 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11008 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11009 LDKQueryChannelRange ret = QueryChannelRange_read(ser_ref);
11010 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11011 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11014 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_QueryChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11015 LDKQueryChannelRange obj_conv;
11016 obj_conv.inner = (void*)(obj & (~1));
11017 obj_conv.is_owned = (obj & 1) || (obj == 0);
11018 LDKCVec_u8Z arg_var = QueryChannelRange_write(&obj_conv);
11019 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11020 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11024 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11025 LDKu8slice ser_ref;
11026 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11027 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11028 LDKReplyChannelRange ret = ReplyChannelRange_read(ser_ref);
11029 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11030 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11033 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ReplyChannelRange_1write(JNIEnv * _env, jclass _b, jlong obj) {
11034 LDKReplyChannelRange obj_conv;
11035 obj_conv.inner = (void*)(obj & (~1));
11036 obj_conv.is_owned = (obj & 1) || (obj == 0);
11037 LDKCVec_u8Z arg_var = ReplyChannelRange_write(&obj_conv);
11038 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11039 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11043 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11044 LDKu8slice ser_ref;
11045 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11046 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11047 LDKGossipTimestampFilter ret = GossipTimestampFilter_read(ser_ref);
11048 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11049 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11052 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_GossipTimestampFilter_1write(JNIEnv * _env, jclass _b, jlong obj) {
11053 LDKGossipTimestampFilter obj_conv;
11054 obj_conv.inner = (void*)(obj & (~1));
11055 obj_conv.is_owned = (obj & 1) || (obj == 0);
11056 LDKCVec_u8Z arg_var = GossipTimestampFilter_write(&obj_conv);
11057 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11058 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11062 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11063 LDKMessageHandler this_ptr_conv;
11064 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11065 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11066 MessageHandler_free(this_ptr_conv);
11069 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11070 LDKMessageHandler 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 long ret = (long)MessageHandler_get_chan_handler(&this_ptr_conv);
11077 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11078 LDKMessageHandler this_ptr_conv;
11079 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11080 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11081 LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
11082 if (val_conv.free == LDKChannelMessageHandler_JCalls_free) {
11083 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11084 LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
11086 MessageHandler_set_chan_handler(&this_ptr_conv, val_conv);
11089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
11090 LDKMessageHandler this_ptr_conv;
11091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11093 long ret = (long)MessageHandler_get_route_handler(&this_ptr_conv);
11097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11098 LDKMessageHandler this_ptr_conv;
11099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11101 LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
11102 if (val_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11103 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11104 LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
11106 MessageHandler_set_route_handler(&this_ptr_conv, val_conv);
11109 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
11110 LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
11111 if (chan_handler_arg_conv.free == LDKChannelMessageHandler_JCalls_free) {
11112 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11113 LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
11115 LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
11116 if (route_handler_arg_conv.free == LDKRoutingMessageHandler_JCalls_free) {
11117 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11118 LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
11120 LDKMessageHandler ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
11121 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11124 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11125 LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
11126 FREE((void*)this_ptr);
11127 SocketDescriptor_free(this_ptr_conv);
11130 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11131 LDKPeerHandleError this_ptr_conv;
11132 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11133 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11134 PeerHandleError_free(this_ptr_conv);
11137 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
11138 LDKPeerHandleError this_ptr_conv;
11139 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11140 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11141 jboolean ret_val = PeerHandleError_get_no_connection_possible(&this_ptr_conv);
11145 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11146 LDKPeerHandleError this_ptr_conv;
11147 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11148 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11149 PeerHandleError_set_no_connection_possible(&this_ptr_conv, val);
11152 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
11153 LDKPeerHandleError ret = PeerHandleError_new(no_connection_possible_arg);
11154 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11157 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11158 LDKPeerManager this_ptr_conv;
11159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11161 PeerManager_free(this_ptr_conv);
11164 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) {
11165 LDKMessageHandler message_handler_conv;
11166 message_handler_conv.inner = (void*)(message_handler & (~1));
11167 message_handler_conv.is_owned = (message_handler & 1) || (message_handler == 0);
11168 // Warning: we may need a move here but can't clone!
11169 LDKSecretKey our_node_secret_ref;
11170 CHECK((*_env)->GetArrayLength (_env, our_node_secret) == 32);
11171 (*_env)->GetByteArrayRegion (_env, our_node_secret, 0, 32, our_node_secret_ref.bytes);
11172 unsigned char ephemeral_random_data_arr[32];
11173 CHECK((*_env)->GetArrayLength (_env, ephemeral_random_data) == 32);
11174 (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
11175 unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
11176 LDKLogger logger_conv = *(LDKLogger*)logger;
11177 if (logger_conv.free == LDKLogger_JCalls_free) {
11178 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11179 LDKLogger_JCalls_clone(logger_conv.this_arg);
11181 LDKPeerManager ret = PeerManager_new(message_handler_conv, our_node_secret_ref, ephemeral_random_data_ref, logger_conv);
11182 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11185 JNIEXPORT jobjectArray JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
11186 LDKPeerManager this_arg_conv;
11187 this_arg_conv.inner = (void*)(this_arg & (~1));
11188 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11189 LDKCVec_PublicKeyZ ret_var = PeerManager_get_peer_node_ids(&this_arg_conv);
11190 jobjectArray ret_arr = (*_env)->NewObjectArray(_env, ret_var.datalen, NULL, NULL);
11191 for (size_t i = 0; i < ret_var.datalen; i++) {
11192 jbyteArray arr_conv_8_arr = (*_env)->NewByteArray(_env, 33);
11193 (*_env)->SetByteArrayRegion(_env, arr_conv_8_arr, 0, 33, ret_var.data[i].compressed_form);
11194 (*_env)->SetObjectArrayElement(_env, ret_arr, i, arr_conv_8_arr);}
11198 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) {
11199 LDKPeerManager this_arg_conv;
11200 this_arg_conv.inner = (void*)(this_arg & (~1));
11201 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11202 LDKPublicKey their_node_id_ref;
11203 CHECK((*_env)->GetArrayLength (_env, their_node_id) == 33);
11204 (*_env)->GetByteArrayRegion (_env, their_node_id, 0, 33, their_node_id_ref.compressed_form);
11205 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11206 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11207 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11208 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11210 LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
11211 *ret = PeerManager_new_outbound_connection(&this_arg_conv, their_node_id_ref, descriptor_conv);
11215 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11216 LDKPeerManager this_arg_conv;
11217 this_arg_conv.inner = (void*)(this_arg & (~1));
11218 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11219 LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
11220 if (descriptor_conv.free == LDKSocketDescriptor_JCalls_free) {
11221 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
11222 LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
11224 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11225 *ret = PeerManager_new_inbound_connection(&this_arg_conv, descriptor_conv);
11229 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11230 LDKPeerManager this_arg_conv;
11231 this_arg_conv.inner = (void*)(this_arg & (~1));
11232 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11233 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11234 LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
11235 *ret = PeerManager_write_buffer_space_avail(&this_arg_conv, descriptor_conv);
11239 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jbyteArray data) {
11240 LDKPeerManager this_arg_conv;
11241 this_arg_conv.inner = (void*)(this_arg & (~1));
11242 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11243 LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
11244 LDKu8slice data_ref;
11245 data_ref.data = (*_env)->GetByteArrayElements (_env, data, NULL);
11246 data_ref.datalen = (*_env)->GetArrayLength (_env, data);
11247 LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
11248 *ret = PeerManager_read_event(&this_arg_conv, peer_descriptor_conv, data_ref);
11249 (*_env)->ReleaseByteArrayElements(_env, data, (int8_t*)data_ref.data, 0);
11253 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
11254 LDKPeerManager this_arg_conv;
11255 this_arg_conv.inner = (void*)(this_arg & (~1));
11256 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11257 PeerManager_process_events(&this_arg_conv);
11260 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
11261 LDKPeerManager this_arg_conv;
11262 this_arg_conv.inner = (void*)(this_arg & (~1));
11263 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11264 LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
11265 PeerManager_socket_disconnected(&this_arg_conv, descriptor_conv);
11268 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
11269 LDKPeerManager this_arg_conv;
11270 this_arg_conv.inner = (void*)(this_arg & (~1));
11271 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11272 PeerManager_timer_tick_occured(&this_arg_conv);
11275 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
11276 unsigned char commitment_seed_arr[32];
11277 CHECK((*_env)->GetArrayLength (_env, commitment_seed) == 32);
11278 (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
11279 unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
11280 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11281 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, build_commitment_secret(commitment_seed_ref, idx).data);
11285 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1private_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_secret) {
11286 LDKPublicKey per_commitment_point_ref;
11287 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11288 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11289 unsigned char base_secret_arr[32];
11290 CHECK((*_env)->GetArrayLength (_env, base_secret) == 32);
11291 (*_env)->GetByteArrayRegion (_env, base_secret, 0, 32, base_secret_arr);
11292 unsigned char (*base_secret_ref)[32] = &base_secret_arr;
11293 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11294 *ret = derive_private_key(per_commitment_point_ref, base_secret_ref);
11298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_derive_1public_1key(JNIEnv * _env, jclass _b, jbyteArray per_commitment_point, jbyteArray base_point) {
11299 LDKPublicKey per_commitment_point_ref;
11300 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11301 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11302 LDKPublicKey base_point_ref;
11303 CHECK((*_env)->GetArrayLength (_env, base_point) == 33);
11304 (*_env)->GetByteArrayRegion (_env, base_point, 0, 33, base_point_ref.compressed_form);
11305 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11306 *ret = derive_public_key(per_commitment_point_ref, base_point_ref);
11310 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) {
11311 unsigned char per_commitment_secret_arr[32];
11312 CHECK((*_env)->GetArrayLength (_env, per_commitment_secret) == 32);
11313 (*_env)->GetByteArrayRegion (_env, per_commitment_secret, 0, 32, per_commitment_secret_arr);
11314 unsigned char (*per_commitment_secret_ref)[32] = &per_commitment_secret_arr;
11315 unsigned char countersignatory_revocation_base_secret_arr[32];
11316 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_secret) == 32);
11317 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_secret, 0, 32, countersignatory_revocation_base_secret_arr);
11318 unsigned char (*countersignatory_revocation_base_secret_ref)[32] = &countersignatory_revocation_base_secret_arr;
11319 LDKCResult_SecretKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_SecretKeySecpErrorZ), "LDKCResult_SecretKeySecpErrorZ");
11320 *ret = derive_private_revocation_key(per_commitment_secret_ref, countersignatory_revocation_base_secret_ref);
11324 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) {
11325 LDKPublicKey per_commitment_point_ref;
11326 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11327 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11328 LDKPublicKey countersignatory_revocation_base_point_ref;
11329 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base_point) == 33);
11330 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base_point, 0, 33, countersignatory_revocation_base_point_ref.compressed_form);
11331 LDKCResult_PublicKeySecpErrorZ* ret = MALLOC(sizeof(LDKCResult_PublicKeySecpErrorZ), "LDKCResult_PublicKeySecpErrorZ");
11332 *ret = derive_public_revocation_key(per_commitment_point_ref, countersignatory_revocation_base_point_ref);
11336 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11337 LDKTxCreationKeys this_ptr_conv;
11338 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11339 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11340 TxCreationKeys_free(this_ptr_conv);
11343 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11344 LDKTxCreationKeys orig_conv;
11345 orig_conv.inner = (void*)(orig & (~1));
11346 orig_conv.is_owned = (orig & 1) || (orig == 0);
11347 LDKTxCreationKeys ret = TxCreationKeys_clone(&orig_conv);
11348 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11351 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11352 LDKTxCreationKeys this_ptr_conv;
11353 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11354 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11355 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11356 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_per_commitment_point(&this_ptr_conv).compressed_form);
11360 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11361 LDKTxCreationKeys this_ptr_conv;
11362 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11363 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11364 LDKPublicKey val_ref;
11365 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11366 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11367 TxCreationKeys_set_per_commitment_point(&this_ptr_conv, val_ref);
11370 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11371 LDKTxCreationKeys 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11375 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_revocation_key(&this_ptr_conv).compressed_form);
11379 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11380 LDKTxCreationKeys this_ptr_conv;
11381 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11382 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11383 LDKPublicKey val_ref;
11384 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11385 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11386 TxCreationKeys_set_revocation_key(&this_ptr_conv, val_ref);
11389 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11390 LDKTxCreationKeys this_ptr_conv;
11391 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11392 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11393 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11394 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_htlc_key(&this_ptr_conv).compressed_form);
11398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11399 LDKTxCreationKeys this_ptr_conv;
11400 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11401 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11402 LDKPublicKey val_ref;
11403 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11404 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11405 TxCreationKeys_set_broadcaster_htlc_key(&this_ptr_conv, val_ref);
11408 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11409 LDKTxCreationKeys 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 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11413 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_countersignatory_htlc_key(&this_ptr_conv).compressed_form);
11417 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1countersignatory_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11418 LDKTxCreationKeys this_ptr_conv;
11419 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11420 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11421 LDKPublicKey val_ref;
11422 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11423 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11424 TxCreationKeys_set_countersignatory_htlc_key(&this_ptr_conv, val_ref);
11427 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
11428 LDKTxCreationKeys this_ptr_conv;
11429 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11430 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11431 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11432 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, TxCreationKeys_get_broadcaster_delayed_payment_key(&this_ptr_conv).compressed_form);
11436 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1broadcaster_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11437 LDKTxCreationKeys this_ptr_conv;
11438 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11439 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11440 LDKPublicKey val_ref;
11441 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11442 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11443 TxCreationKeys_set_broadcaster_delayed_payment_key(&this_ptr_conv, val_ref);
11446 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) {
11447 LDKPublicKey per_commitment_point_arg_ref;
11448 CHECK((*_env)->GetArrayLength (_env, per_commitment_point_arg) == 33);
11449 (*_env)->GetByteArrayRegion (_env, per_commitment_point_arg, 0, 33, per_commitment_point_arg_ref.compressed_form);
11450 LDKPublicKey revocation_key_arg_ref;
11451 CHECK((*_env)->GetArrayLength (_env, revocation_key_arg) == 33);
11452 (*_env)->GetByteArrayRegion (_env, revocation_key_arg, 0, 33, revocation_key_arg_ref.compressed_form);
11453 LDKPublicKey broadcaster_htlc_key_arg_ref;
11454 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_key_arg) == 33);
11455 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_key_arg, 0, 33, broadcaster_htlc_key_arg_ref.compressed_form);
11456 LDKPublicKey countersignatory_htlc_key_arg_ref;
11457 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_key_arg) == 33);
11458 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_key_arg, 0, 33, countersignatory_htlc_key_arg_ref.compressed_form);
11459 LDKPublicKey broadcaster_delayed_payment_key_arg_ref;
11460 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key_arg) == 33);
11461 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key_arg, 0, 33, broadcaster_delayed_payment_key_arg_ref.compressed_form);
11462 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);
11463 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11466 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11467 LDKTxCreationKeys obj_conv;
11468 obj_conv.inner = (void*)(obj & (~1));
11469 obj_conv.is_owned = (obj & 1) || (obj == 0);
11470 LDKCVec_u8Z arg_var = TxCreationKeys_write(&obj_conv);
11471 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11472 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11476 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11477 LDKu8slice ser_ref;
11478 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11479 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11480 LDKTxCreationKeys ret = TxCreationKeys_read(ser_ref);
11481 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11482 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11485 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11486 LDKPreCalculatedTxCreationKeys this_ptr_conv;
11487 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11488 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11489 PreCalculatedTxCreationKeys_free(this_ptr_conv);
11492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
11493 LDKTxCreationKeys keys_conv;
11494 keys_conv.inner = (void*)(keys & (~1));
11495 keys_conv.is_owned = (keys & 1) || (keys == 0);
11496 if (keys_conv.inner != NULL)
11497 keys_conv = TxCreationKeys_clone(&keys_conv);
11498 LDKPreCalculatedTxCreationKeys ret = PreCalculatedTxCreationKeys_new(keys_conv);
11499 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11503 LDKPreCalculatedTxCreationKeys this_arg_conv;
11504 this_arg_conv.inner = (void*)(this_arg & (~1));
11505 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11506 LDKTxCreationKeys ret = PreCalculatedTxCreationKeys_trust_key_derivation(&this_arg_conv);
11507 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11510 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
11511 LDKPreCalculatedTxCreationKeys this_arg_conv;
11512 this_arg_conv.inner = (void*)(this_arg & (~1));
11513 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11514 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11515 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, PreCalculatedTxCreationKeys_per_commitment_point(&this_arg_conv).compressed_form);
11519 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11520 LDKChannelPublicKeys this_ptr_conv;
11521 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11522 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11523 ChannelPublicKeys_free(this_ptr_conv);
11526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11527 LDKChannelPublicKeys orig_conv;
11528 orig_conv.inner = (void*)(orig & (~1));
11529 orig_conv.is_owned = (orig & 1) || (orig == 0);
11530 LDKChannelPublicKeys ret = ChannelPublicKeys_clone(&orig_conv);
11531 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11534 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
11535 LDKChannelPublicKeys this_ptr_conv;
11536 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11537 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11538 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11539 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_funding_pubkey(&this_ptr_conv).compressed_form);
11543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11544 LDKChannelPublicKeys this_ptr_conv;
11545 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11546 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11547 LDKPublicKey val_ref;
11548 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11549 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11550 ChannelPublicKeys_set_funding_pubkey(&this_ptr_conv, val_ref);
11553 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11554 LDKChannelPublicKeys this_ptr_conv;
11555 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11556 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11557 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11558 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_revocation_basepoint(&this_ptr_conv).compressed_form);
11562 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11563 LDKChannelPublicKeys this_ptr_conv;
11564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11566 LDKPublicKey val_ref;
11567 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11568 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11569 ChannelPublicKeys_set_revocation_basepoint(&this_ptr_conv, val_ref);
11572 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
11573 LDKChannelPublicKeys this_ptr_conv;
11574 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11575 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11576 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11577 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_payment_point(&this_ptr_conv).compressed_form);
11581 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11582 LDKChannelPublicKeys this_ptr_conv;
11583 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11584 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11585 LDKPublicKey val_ref;
11586 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11587 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11588 ChannelPublicKeys_set_payment_point(&this_ptr_conv, val_ref);
11591 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11592 LDKChannelPublicKeys this_ptr_conv;
11593 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11594 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11595 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11596 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_delayed_payment_basepoint(&this_ptr_conv).compressed_form);
11600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11601 LDKChannelPublicKeys this_ptr_conv;
11602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11604 LDKPublicKey val_ref;
11605 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11606 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11607 ChannelPublicKeys_set_delayed_payment_basepoint(&this_ptr_conv, val_ref);
11610 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
11611 LDKChannelPublicKeys this_ptr_conv;
11612 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11613 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11614 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
11615 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelPublicKeys_get_htlc_basepoint(&this_ptr_conv).compressed_form);
11619 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11620 LDKChannelPublicKeys this_ptr_conv;
11621 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11622 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11623 LDKPublicKey val_ref;
11624 CHECK((*_env)->GetArrayLength (_env, val) == 33);
11625 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
11626 ChannelPublicKeys_set_htlc_basepoint(&this_ptr_conv, val_ref);
11629 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) {
11630 LDKPublicKey funding_pubkey_arg_ref;
11631 CHECK((*_env)->GetArrayLength (_env, funding_pubkey_arg) == 33);
11632 (*_env)->GetByteArrayRegion (_env, funding_pubkey_arg, 0, 33, funding_pubkey_arg_ref.compressed_form);
11633 LDKPublicKey revocation_basepoint_arg_ref;
11634 CHECK((*_env)->GetArrayLength (_env, revocation_basepoint_arg) == 33);
11635 (*_env)->GetByteArrayRegion (_env, revocation_basepoint_arg, 0, 33, revocation_basepoint_arg_ref.compressed_form);
11636 LDKPublicKey payment_point_arg_ref;
11637 CHECK((*_env)->GetArrayLength (_env, payment_point_arg) == 33);
11638 (*_env)->GetByteArrayRegion (_env, payment_point_arg, 0, 33, payment_point_arg_ref.compressed_form);
11639 LDKPublicKey delayed_payment_basepoint_arg_ref;
11640 CHECK((*_env)->GetArrayLength (_env, delayed_payment_basepoint_arg) == 33);
11641 (*_env)->GetByteArrayRegion (_env, delayed_payment_basepoint_arg, 0, 33, delayed_payment_basepoint_arg_ref.compressed_form);
11642 LDKPublicKey htlc_basepoint_arg_ref;
11643 CHECK((*_env)->GetArrayLength (_env, htlc_basepoint_arg) == 33);
11644 (*_env)->GetByteArrayRegion (_env, htlc_basepoint_arg, 0, 33, htlc_basepoint_arg_ref.compressed_form);
11645 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);
11646 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11649 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
11650 LDKChannelPublicKeys obj_conv;
11651 obj_conv.inner = (void*)(obj & (~1));
11652 obj_conv.is_owned = (obj & 1) || (obj == 0);
11653 LDKCVec_u8Z arg_var = ChannelPublicKeys_write(&obj_conv);
11654 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11655 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11660 LDKu8slice ser_ref;
11661 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11662 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11663 LDKChannelPublicKeys ret = ChannelPublicKeys_read(ser_ref);
11664 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11665 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11668 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) {
11669 LDKPublicKey per_commitment_point_ref;
11670 CHECK((*_env)->GetArrayLength (_env, per_commitment_point) == 33);
11671 (*_env)->GetByteArrayRegion (_env, per_commitment_point, 0, 33, per_commitment_point_ref.compressed_form);
11672 LDKPublicKey broadcaster_delayed_payment_base_ref;
11673 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_base) == 33);
11674 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_base, 0, 33, broadcaster_delayed_payment_base_ref.compressed_form);
11675 LDKPublicKey broadcaster_htlc_base_ref;
11676 CHECK((*_env)->GetArrayLength (_env, broadcaster_htlc_base) == 33);
11677 (*_env)->GetByteArrayRegion (_env, broadcaster_htlc_base, 0, 33, broadcaster_htlc_base_ref.compressed_form);
11678 LDKPublicKey countersignatory_revocation_base_ref;
11679 CHECK((*_env)->GetArrayLength (_env, countersignatory_revocation_base) == 33);
11680 (*_env)->GetByteArrayRegion (_env, countersignatory_revocation_base, 0, 33, countersignatory_revocation_base_ref.compressed_form);
11681 LDKPublicKey countersignatory_htlc_base_ref;
11682 CHECK((*_env)->GetArrayLength (_env, countersignatory_htlc_base) == 33);
11683 (*_env)->GetByteArrayRegion (_env, countersignatory_htlc_base, 0, 33, countersignatory_htlc_base_ref.compressed_form);
11684 LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
11685 *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);
11689 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray revocation_key, jshort contest_delay, jbyteArray broadcaster_delayed_payment_key) {
11690 LDKPublicKey revocation_key_ref;
11691 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11692 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11693 LDKPublicKey broadcaster_delayed_payment_key_ref;
11694 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11695 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11696 LDKCVec_u8Z arg_var = get_revokeable_redeemscript(revocation_key_ref, contest_delay, broadcaster_delayed_payment_key_ref);
11697 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11698 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11702 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11703 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_free(this_ptr_conv);
11709 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11710 LDKHTLCOutputInCommitment orig_conv;
11711 orig_conv.inner = (void*)(orig & (~1));
11712 orig_conv.is_owned = (orig & 1) || (orig == 0);
11713 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_clone(&orig_conv);
11714 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11717 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
11718 LDKHTLCOutputInCommitment 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 jboolean ret_val = HTLCOutputInCommitment_get_offered(&this_ptr_conv);
11725 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
11726 LDKHTLCOutputInCommitment this_ptr_conv;
11727 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11728 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11729 HTLCOutputInCommitment_set_offered(&this_ptr_conv, val);
11732 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
11733 LDKHTLCOutputInCommitment this_ptr_conv;
11734 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11735 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11736 jlong ret_val = HTLCOutputInCommitment_get_amount_msat(&this_ptr_conv);
11740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11741 LDKHTLCOutputInCommitment this_ptr_conv;
11742 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11743 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11744 HTLCOutputInCommitment_set_amount_msat(&this_ptr_conv, val);
11747 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
11748 LDKHTLCOutputInCommitment this_ptr_conv;
11749 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11750 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11751 jint ret_val = HTLCOutputInCommitment_get_cltv_expiry(&this_ptr_conv);
11755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11756 LDKHTLCOutputInCommitment 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 HTLCOutputInCommitment_set_cltv_expiry(&this_ptr_conv, val);
11762 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
11763 LDKHTLCOutputInCommitment this_ptr_conv;
11764 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11765 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11766 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
11767 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(&this_ptr_conv));
11771 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11772 LDKHTLCOutputInCommitment this_ptr_conv;
11773 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11774 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11775 LDKThirtyTwoBytes val_ref;
11776 CHECK((*_env)->GetArrayLength (_env, val) == 32);
11777 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
11778 HTLCOutputInCommitment_set_payment_hash(&this_ptr_conv, val_ref);
11781 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
11782 LDKHTLCOutputInCommitment obj_conv;
11783 obj_conv.inner = (void*)(obj & (~1));
11784 obj_conv.is_owned = (obj & 1) || (obj == 0);
11785 LDKCVec_u8Z arg_var = HTLCOutputInCommitment_write(&obj_conv);
11786 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11787 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
11792 LDKu8slice ser_ref;
11793 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
11794 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
11795 LDKHTLCOutputInCommitment ret = HTLCOutputInCommitment_read(ser_ref);
11796 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
11797 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11800 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
11801 LDKHTLCOutputInCommitment htlc_conv;
11802 htlc_conv.inner = (void*)(htlc & (~1));
11803 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11804 LDKTxCreationKeys keys_conv;
11805 keys_conv.inner = (void*)(keys & (~1));
11806 keys_conv.is_owned = (keys & 1) || (keys == 0);
11807 LDKCVec_u8Z arg_var = get_htlc_redeemscript(&htlc_conv, &keys_conv);
11808 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11809 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11813 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jbyteArray broadcaster, jbyteArray countersignatory) {
11814 LDKPublicKey broadcaster_ref;
11815 CHECK((*_env)->GetArrayLength (_env, broadcaster) == 33);
11816 (*_env)->GetByteArrayRegion (_env, broadcaster, 0, 33, broadcaster_ref.compressed_form);
11817 LDKPublicKey countersignatory_ref;
11818 CHECK((*_env)->GetArrayLength (_env, countersignatory) == 33);
11819 (*_env)->GetByteArrayRegion (_env, countersignatory, 0, 33, countersignatory_ref.compressed_form);
11820 LDKCVec_u8Z arg_var = make_funding_redeemscript(broadcaster_ref, countersignatory_ref);
11821 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
11822 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
11826 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) {
11827 unsigned char prev_hash_arr[32];
11828 CHECK((*_env)->GetArrayLength (_env, prev_hash) == 32);
11829 (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
11830 unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
11831 LDKHTLCOutputInCommitment htlc_conv;
11832 htlc_conv.inner = (void*)(htlc & (~1));
11833 htlc_conv.is_owned = (htlc & 1) || (htlc == 0);
11834 LDKPublicKey broadcaster_delayed_payment_key_ref;
11835 CHECK((*_env)->GetArrayLength (_env, broadcaster_delayed_payment_key) == 33);
11836 (*_env)->GetByteArrayRegion (_env, broadcaster_delayed_payment_key, 0, 33, broadcaster_delayed_payment_key_ref.compressed_form);
11837 LDKPublicKey revocation_key_ref;
11838 CHECK((*_env)->GetArrayLength (_env, revocation_key) == 33);
11839 (*_env)->GetByteArrayRegion (_env, revocation_key, 0, 33, revocation_key_ref.compressed_form);
11840 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11841 *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, contest_delay, &htlc_conv, broadcaster_delayed_payment_key_ref, revocation_key_ref);
11845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
11846 LDKHolderCommitmentTransaction this_ptr_conv;
11847 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11848 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11849 HolderCommitmentTransaction_free(this_ptr_conv);
11852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1clone(JNIEnv * _env, jclass _b, jlong orig) {
11853 LDKHolderCommitmentTransaction orig_conv;
11854 orig_conv.inner = (void*)(orig & (~1));
11855 orig_conv.is_owned = (orig & 1) || (orig == 0);
11856 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_clone(&orig_conv);
11857 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11860 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
11861 LDKHolderCommitmentTransaction 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 LDKTransaction* ret = MALLOC(sizeof(LDKTransaction), "LDKTransaction");
11865 *ret = HolderCommitmentTransaction_get_unsigned_tx(&this_ptr_conv);
11869 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
11870 LDKHolderCommitmentTransaction this_ptr_conv;
11871 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11872 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11873 LDKTransaction val_conv = *(LDKTransaction*)val;
11875 HolderCommitmentTransaction_set_unsigned_tx(&this_ptr_conv, val_conv);
11878 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
11879 LDKHolderCommitmentTransaction this_ptr_conv;
11880 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11881 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11882 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11883 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 64, HolderCommitmentTransaction_get_counterparty_sig(&this_ptr_conv).compact_form);
11887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1counterparty_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
11888 LDKHolderCommitmentTransaction this_ptr_conv;
11889 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11890 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11891 LDKSignature val_ref;
11892 CHECK((*_env)->GetArrayLength (_env, val) == 64);
11893 (*_env)->GetByteArrayRegion (_env, val, 0, 64, val_ref.compact_form);
11894 HolderCommitmentTransaction_set_counterparty_sig(&this_ptr_conv, val_ref);
11897 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
11898 LDKHolderCommitmentTransaction this_ptr_conv;
11899 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11900 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11901 jint ret_val = HolderCommitmentTransaction_get_feerate_per_kw(&this_ptr_conv);
11905 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
11906 LDKHolderCommitmentTransaction this_ptr_conv;
11907 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11908 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11909 HolderCommitmentTransaction_set_feerate_per_kw(&this_ptr_conv, val);
11912 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
11913 LDKHolderCommitmentTransaction this_ptr_conv;
11914 this_ptr_conv.inner = (void*)(this_ptr & (~1));
11915 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
11916 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_constr;
11917 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
11918 if (val_constr.datalen > 0)
11919 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11921 val_constr.data = NULL;
11922 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
11923 for (size_t q = 0; q < val_constr.datalen; q++) {
11924 long arr_conv_42 = val_vals[q];
11925 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11926 FREE((void*)arr_conv_42);
11927 val_constr.data[q] = arr_conv_42_conv;
11929 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
11930 HolderCommitmentTransaction_set_per_htlc(&this_ptr_conv, val_constr);
11933 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, jlongArray htlc_data) {
11934 LDKTransaction unsigned_tx_conv = *(LDKTransaction*)unsigned_tx;
11935 FREE((void*)unsigned_tx);
11936 LDKSignature counterparty_sig_ref;
11937 CHECK((*_env)->GetArrayLength (_env, counterparty_sig) == 64);
11938 (*_env)->GetByteArrayRegion (_env, counterparty_sig, 0, 64, counterparty_sig_ref.compact_form);
11939 LDKPublicKey holder_funding_key_ref;
11940 CHECK((*_env)->GetArrayLength (_env, holder_funding_key) == 33);
11941 (*_env)->GetByteArrayRegion (_env, holder_funding_key, 0, 33, holder_funding_key_ref.compressed_form);
11942 LDKPublicKey counterparty_funding_key_ref;
11943 CHECK((*_env)->GetArrayLength (_env, counterparty_funding_key) == 33);
11944 (*_env)->GetByteArrayRegion (_env, counterparty_funding_key, 0, 33, counterparty_funding_key_ref.compressed_form);
11945 LDKTxCreationKeys keys_conv;
11946 keys_conv.inner = (void*)(keys & (~1));
11947 keys_conv.is_owned = (keys & 1) || (keys == 0);
11948 if (keys_conv.inner != NULL)
11949 keys_conv = TxCreationKeys_clone(&keys_conv);
11950 LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_constr;
11951 htlc_data_constr.datalen = (*_env)->GetArrayLength (_env, htlc_data);
11952 if (htlc_data_constr.datalen > 0)
11953 htlc_data_constr.data = MALLOC(htlc_data_constr.datalen * sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ Elements");
11955 htlc_data_constr.data = NULL;
11956 long* htlc_data_vals = (*_env)->GetLongArrayElements (_env, htlc_data, NULL);
11957 for (size_t q = 0; q < htlc_data_constr.datalen; q++) {
11958 long arr_conv_42 = htlc_data_vals[q];
11959 LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arr_conv_42_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arr_conv_42;
11960 FREE((void*)arr_conv_42);
11961 htlc_data_constr.data[q] = arr_conv_42_conv;
11963 (*_env)->ReleaseLongArrayElements (_env, htlc_data, htlc_data_vals, 0);
11964 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_constr);
11965 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11968 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
11969 LDKHolderCommitmentTransaction this_arg_conv;
11970 this_arg_conv.inner = (void*)(this_arg & (~1));
11971 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11972 LDKTxCreationKeys ret = HolderCommitmentTransaction_trust_key_derivation(&this_arg_conv);
11973 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
11976 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
11977 LDKHolderCommitmentTransaction this_arg_conv;
11978 this_arg_conv.inner = (void*)(this_arg & (~1));
11979 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11980 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 32);
11981 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 32, HolderCommitmentTransaction_txid(&this_arg_conv).data);
11985 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) {
11986 LDKHolderCommitmentTransaction this_arg_conv;
11987 this_arg_conv.inner = (void*)(this_arg & (~1));
11988 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
11989 unsigned char funding_key_arr[32];
11990 CHECK((*_env)->GetArrayLength (_env, funding_key) == 32);
11991 (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
11992 unsigned char (*funding_key_ref)[32] = &funding_key_arr;
11993 LDKu8slice funding_redeemscript_ref;
11994 funding_redeemscript_ref.data = (*_env)->GetByteArrayElements (_env, funding_redeemscript, NULL);
11995 funding_redeemscript_ref.datalen = (*_env)->GetArrayLength (_env, funding_redeemscript);
11996 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 64);
11997 (*_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);
11998 (*_env)->ReleaseByteArrayElements(_env, funding_redeemscript, (int8_t*)funding_redeemscript_ref.data, 0);
12002 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) {
12003 LDKHolderCommitmentTransaction this_arg_conv;
12004 this_arg_conv.inner = (void*)(this_arg & (~1));
12005 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12006 unsigned char htlc_base_key_arr[32];
12007 CHECK((*_env)->GetArrayLength (_env, htlc_base_key) == 32);
12008 (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
12009 unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
12010 LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
12011 *ret = HolderCommitmentTransaction_get_htlc_sigs(&this_arg_conv, htlc_base_key_ref, counterparty_selected_contest_delay);
12015 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
12016 LDKHolderCommitmentTransaction obj_conv;
12017 obj_conv.inner = (void*)(obj & (~1));
12018 obj_conv.is_owned = (obj & 1) || (obj == 0);
12019 LDKCVec_u8Z arg_var = HolderCommitmentTransaction_write(&obj_conv);
12020 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12021 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HolderCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12026 LDKu8slice ser_ref;
12027 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12028 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12029 LDKHolderCommitmentTransaction ret = HolderCommitmentTransaction_read(ser_ref);
12030 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12031 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12035 LDKInitFeatures this_ptr_conv;
12036 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12037 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12038 InitFeatures_free(this_ptr_conv);
12041 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12042 LDKNodeFeatures this_ptr_conv;
12043 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12044 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12045 NodeFeatures_free(this_ptr_conv);
12048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12049 LDKChannelFeatures this_ptr_conv;
12050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12052 ChannelFeatures_free(this_ptr_conv);
12055 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12056 LDKRouteHop this_ptr_conv;
12057 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12058 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12059 RouteHop_free(this_ptr_conv);
12062 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12063 LDKRouteHop orig_conv;
12064 orig_conv.inner = (void*)(orig & (~1));
12065 orig_conv.is_owned = (orig & 1) || (orig == 0);
12066 LDKRouteHop ret = RouteHop_clone(&orig_conv);
12067 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12070 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
12071 LDKRouteHop this_ptr_conv;
12072 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12073 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12074 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12075 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHop_get_pubkey(&this_ptr_conv).compressed_form);
12079 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12080 LDKRouteHop this_ptr_conv;
12081 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12082 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12083 LDKPublicKey val_ref;
12084 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12085 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12086 RouteHop_set_pubkey(&this_ptr_conv, val_ref);
12089 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12090 LDKRouteHop this_ptr_conv;
12091 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12092 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12093 LDKNodeFeatures ret = RouteHop_get_node_features(&this_ptr_conv);
12094 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1node_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12098 LDKRouteHop this_ptr_conv;
12099 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12100 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12101 LDKNodeFeatures val_conv;
12102 val_conv.inner = (void*)(val & (~1));
12103 val_conv.is_owned = (val & 1) || (val == 0);
12104 // Warning: we may need a move here but can't clone!
12105 RouteHop_set_node_features(&this_ptr_conv, val_conv);
12108 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12109 LDKRouteHop this_ptr_conv;
12110 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12111 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12112 jlong ret_val = RouteHop_get_short_channel_id(&this_ptr_conv);
12116 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12117 LDKRouteHop this_ptr_conv;
12118 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12119 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12120 RouteHop_set_short_channel_id(&this_ptr_conv, val);
12123 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12124 LDKRouteHop this_ptr_conv;
12125 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12126 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12127 LDKChannelFeatures ret = RouteHop_get_channel_features(&this_ptr_conv);
12128 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12131 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1channel_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12132 LDKRouteHop this_ptr_conv;
12133 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12134 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12135 LDKChannelFeatures val_conv;
12136 val_conv.inner = (void*)(val & (~1));
12137 val_conv.is_owned = (val & 1) || (val == 0);
12138 // Warning: we may need a move here but can't clone!
12139 RouteHop_set_channel_features(&this_ptr_conv, val_conv);
12142 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12143 LDKRouteHop this_ptr_conv;
12144 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12145 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12146 jlong ret_val = RouteHop_get_fee_msat(&this_ptr_conv);
12150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12151 LDKRouteHop this_ptr_conv;
12152 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12153 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12154 RouteHop_set_fee_msat(&this_ptr_conv, val);
12157 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12158 LDKRouteHop this_ptr_conv;
12159 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12160 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12161 jint ret_val = RouteHop_get_cltv_expiry_delta(&this_ptr_conv);
12165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12166 LDKRouteHop this_ptr_conv;
12167 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12168 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12169 RouteHop_set_cltv_expiry_delta(&this_ptr_conv, val);
12172 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) {
12173 LDKPublicKey pubkey_arg_ref;
12174 CHECK((*_env)->GetArrayLength (_env, pubkey_arg) == 33);
12175 (*_env)->GetByteArrayRegion (_env, pubkey_arg, 0, 33, pubkey_arg_ref.compressed_form);
12176 LDKNodeFeatures node_features_arg_conv;
12177 node_features_arg_conv.inner = (void*)(node_features_arg & (~1));
12178 node_features_arg_conv.is_owned = (node_features_arg & 1) || (node_features_arg == 0);
12179 // Warning: we may need a move here but can't clone!
12180 LDKChannelFeatures channel_features_arg_conv;
12181 channel_features_arg_conv.inner = (void*)(channel_features_arg & (~1));
12182 channel_features_arg_conv.is_owned = (channel_features_arg & 1) || (channel_features_arg == 0);
12183 // Warning: we may need a move here but can't clone!
12184 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);
12185 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12188 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12189 LDKRoute this_ptr_conv;
12190 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12191 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12192 Route_free(this_ptr_conv);
12195 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12196 LDKRoute orig_conv;
12197 orig_conv.inner = (void*)(orig & (~1));
12198 orig_conv.is_owned = (orig & 1) || (orig == 0);
12199 LDKRoute ret = Route_clone(&orig_conv);
12200 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12203 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jobjectArray val) {
12204 LDKRoute this_ptr_conv;
12205 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12206 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12207 LDKCVec_CVec_RouteHopZZ val_constr;
12208 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12209 if (val_constr.datalen > 0)
12210 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12212 val_constr.data = NULL;
12213 for (size_t m = 0; m < val_constr.datalen; m++) {
12214 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, val, m);
12215 LDKCVec_RouteHopZ arr_conv_12_constr;
12216 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12217 if (arr_conv_12_constr.datalen > 0)
12218 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12220 arr_conv_12_constr.data = NULL;
12221 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12222 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12223 long arr_conv_10 = arr_conv_12_vals[k];
12224 LDKRouteHop arr_conv_10_conv;
12225 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12226 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12227 if (arr_conv_10_conv.inner != NULL)
12228 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12229 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12231 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12232 val_constr.data[m] = arr_conv_12_constr;
12234 Route_set_paths(&this_ptr_conv, val_constr);
12237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jobjectArray paths_arg) {
12238 LDKCVec_CVec_RouteHopZZ paths_arg_constr;
12239 paths_arg_constr.datalen = (*_env)->GetArrayLength (_env, paths_arg);
12240 if (paths_arg_constr.datalen > 0)
12241 paths_arg_constr.data = MALLOC(paths_arg_constr.datalen * sizeof(LDKCVec_RouteHopZ), "LDKCVec_CVec_RouteHopZZ Elements");
12243 paths_arg_constr.data = NULL;
12244 for (size_t m = 0; m < paths_arg_constr.datalen; m++) {
12245 jobject arr_conv_12 = (*_env)->GetObjectArrayElement(_env, paths_arg, m);
12246 LDKCVec_RouteHopZ arr_conv_12_constr;
12247 arr_conv_12_constr.datalen = (*_env)->GetArrayLength (_env, arr_conv_12);
12248 if (arr_conv_12_constr.datalen > 0)
12249 arr_conv_12_constr.data = MALLOC(arr_conv_12_constr.datalen * sizeof(LDKRouteHop), "LDKCVec_RouteHopZ Elements");
12251 arr_conv_12_constr.data = NULL;
12252 long* arr_conv_12_vals = (*_env)->GetLongArrayElements (_env, arr_conv_12, NULL);
12253 for (size_t k = 0; k < arr_conv_12_constr.datalen; k++) {
12254 long arr_conv_10 = arr_conv_12_vals[k];
12255 LDKRouteHop arr_conv_10_conv;
12256 arr_conv_10_conv.inner = (void*)(arr_conv_10 & (~1));
12257 arr_conv_10_conv.is_owned = (arr_conv_10 & 1) || (arr_conv_10 == 0);
12258 if (arr_conv_10_conv.inner != NULL)
12259 arr_conv_10_conv = RouteHop_clone(&arr_conv_10_conv);
12260 arr_conv_12_constr.data[k] = arr_conv_10_conv;
12262 (*_env)->ReleaseLongArrayElements (_env, arr_conv_12, arr_conv_12_vals, 0);
12263 paths_arg_constr.data[m] = arr_conv_12_constr;
12265 LDKRoute ret = Route_new(paths_arg_constr);
12266 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12269 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
12271 obj_conv.inner = (void*)(obj & (~1));
12272 obj_conv.is_owned = (obj & 1) || (obj == 0);
12273 LDKCVec_u8Z arg_var = Route_write(&obj_conv);
12274 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12275 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12280 LDKu8slice ser_ref;
12281 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12282 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12283 LDKRoute ret = Route_read(ser_ref);
12284 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12285 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12288 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12289 LDKRouteHint this_ptr_conv;
12290 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12291 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12292 RouteHint_free(this_ptr_conv);
12295 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12296 LDKRouteHint orig_conv;
12297 orig_conv.inner = (void*)(orig & (~1));
12298 orig_conv.is_owned = (orig & 1) || (orig == 0);
12299 LDKRouteHint ret = RouteHint_clone(&orig_conv);
12300 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12303 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12304 LDKRouteHint this_ptr_conv;
12305 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12306 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12307 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12308 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, RouteHint_get_src_node_id(&this_ptr_conv).compressed_form);
12312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12313 LDKRouteHint this_ptr_conv;
12314 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12315 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12316 LDKPublicKey val_ref;
12317 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12318 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12319 RouteHint_set_src_node_id(&this_ptr_conv, val_ref);
12322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
12323 LDKRouteHint this_ptr_conv;
12324 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12325 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12326 jlong ret_val = RouteHint_get_short_channel_id(&this_ptr_conv);
12330 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12331 LDKRouteHint this_ptr_conv;
12332 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12333 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12334 RouteHint_set_short_channel_id(&this_ptr_conv, val);
12337 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
12338 LDKRouteHint this_ptr_conv;
12339 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12340 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12341 LDKRoutingFees ret = RouteHint_get_fees(&this_ptr_conv);
12342 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12345 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12346 LDKRouteHint this_ptr_conv;
12347 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12348 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12349 LDKRoutingFees val_conv;
12350 val_conv.inner = (void*)(val & (~1));
12351 val_conv.is_owned = (val & 1) || (val == 0);
12352 if (val_conv.inner != NULL)
12353 val_conv = RoutingFees_clone(&val_conv);
12354 RouteHint_set_fees(&this_ptr_conv, val_conv);
12357 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12358 LDKRouteHint this_ptr_conv;
12359 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12360 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12361 jshort ret_val = RouteHint_get_cltv_expiry_delta(&this_ptr_conv);
12365 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12366 LDKRouteHint this_ptr_conv;
12367 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12368 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12369 RouteHint_set_cltv_expiry_delta(&this_ptr_conv, val);
12372 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12373 LDKRouteHint this_ptr_conv;
12374 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12375 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12376 jlong ret_val = RouteHint_get_htlc_minimum_msat(&this_ptr_conv);
12380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12381 LDKRouteHint this_ptr_conv;
12382 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12383 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12384 RouteHint_set_htlc_minimum_msat(&this_ptr_conv, val);
12387 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) {
12388 LDKPublicKey src_node_id_arg_ref;
12389 CHECK((*_env)->GetArrayLength (_env, src_node_id_arg) == 33);
12390 (*_env)->GetByteArrayRegion (_env, src_node_id_arg, 0, 33, src_node_id_arg_ref.compressed_form);
12391 LDKRoutingFees fees_arg_conv;
12392 fees_arg_conv.inner = (void*)(fees_arg & (~1));
12393 fees_arg_conv.is_owned = (fees_arg & 1) || (fees_arg == 0);
12394 if (fees_arg_conv.inner != NULL)
12395 fees_arg_conv = RoutingFees_clone(&fees_arg_conv);
12396 LDKRouteHint ret = RouteHint_new(src_node_id_arg_ref, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
12397 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jbyteArray our_node_id, jlong network, jbyteArray target, jlongArray first_hops, jlongArray last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
12401 LDKPublicKey our_node_id_ref;
12402 CHECK((*_env)->GetArrayLength (_env, our_node_id) == 33);
12403 (*_env)->GetByteArrayRegion (_env, our_node_id, 0, 33, our_node_id_ref.compressed_form);
12404 LDKNetworkGraph network_conv;
12405 network_conv.inner = (void*)(network & (~1));
12406 network_conv.is_owned = (network & 1) || (network == 0);
12407 LDKPublicKey target_ref;
12408 CHECK((*_env)->GetArrayLength (_env, target) == 33);
12409 (*_env)->GetByteArrayRegion (_env, target, 0, 33, target_ref.compressed_form);
12410 LDKCVec_ChannelDetailsZ first_hops_constr;
12411 first_hops_constr.datalen = (*_env)->GetArrayLength (_env, first_hops);
12412 if (first_hops_constr.datalen > 0)
12413 first_hops_constr.data = MALLOC(first_hops_constr.datalen * sizeof(LDKChannelDetails), "LDKCVec_ChannelDetailsZ Elements");
12415 first_hops_constr.data = NULL;
12416 long* first_hops_vals = (*_env)->GetLongArrayElements (_env, first_hops, NULL);
12417 for (size_t q = 0; q < first_hops_constr.datalen; q++) {
12418 long arr_conv_16 = first_hops_vals[q];
12419 LDKChannelDetails arr_conv_16_conv;
12420 arr_conv_16_conv.inner = (void*)(arr_conv_16 & (~1));
12421 arr_conv_16_conv.is_owned = (arr_conv_16 & 1) || (arr_conv_16 == 0);
12422 first_hops_constr.data[q] = arr_conv_16_conv;
12424 (*_env)->ReleaseLongArrayElements (_env, first_hops, first_hops_vals, 0);
12425 LDKCVec_RouteHintZ last_hops_constr;
12426 last_hops_constr.datalen = (*_env)->GetArrayLength (_env, last_hops);
12427 if (last_hops_constr.datalen > 0)
12428 last_hops_constr.data = MALLOC(last_hops_constr.datalen * sizeof(LDKRouteHint), "LDKCVec_RouteHintZ Elements");
12430 last_hops_constr.data = NULL;
12431 long* last_hops_vals = (*_env)->GetLongArrayElements (_env, last_hops, NULL);
12432 for (size_t l = 0; l < last_hops_constr.datalen; l++) {
12433 long arr_conv_11 = last_hops_vals[l];
12434 LDKRouteHint arr_conv_11_conv;
12435 arr_conv_11_conv.inner = (void*)(arr_conv_11 & (~1));
12436 arr_conv_11_conv.is_owned = (arr_conv_11 & 1) || (arr_conv_11 == 0);
12437 if (arr_conv_11_conv.inner != NULL)
12438 arr_conv_11_conv = RouteHint_clone(&arr_conv_11_conv);
12439 last_hops_constr.data[l] = arr_conv_11_conv;
12441 (*_env)->ReleaseLongArrayElements (_env, last_hops, last_hops_vals, 0);
12442 LDKLogger logger_conv = *(LDKLogger*)logger;
12443 if (logger_conv.free == LDKLogger_JCalls_free) {
12444 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12445 LDKLogger_JCalls_clone(logger_conv.this_arg);
12447 LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
12448 *ret = get_route(our_node_id_ref, &network_conv, target_ref, &first_hops_constr, last_hops_constr, final_value_msat, final_cltv, logger_conv);
12449 FREE(first_hops_constr.data);
12453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12454 LDKNetworkGraph this_ptr_conv;
12455 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12456 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12457 NetworkGraph_free(this_ptr_conv);
12460 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12461 LDKLockedNetworkGraph this_ptr_conv;
12462 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12463 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12464 LockedNetworkGraph_free(this_ptr_conv);
12467 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12468 LDKNetGraphMsgHandler this_ptr_conv;
12469 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12470 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12471 NetGraphMsgHandler_free(this_ptr_conv);
12474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger) {
12475 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12476 LDKLogger logger_conv = *(LDKLogger*)logger;
12477 if (logger_conv.free == LDKLogger_JCalls_free) {
12478 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12479 LDKLogger_JCalls_clone(logger_conv.this_arg);
12481 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_new(chain_access_conv, logger_conv);
12482 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_access, jlong logger, jlong network_graph) {
12486 LDKAccess* chain_access_conv = (LDKAccess*)chain_access;
12487 LDKLogger logger_conv = *(LDKLogger*)logger;
12488 if (logger_conv.free == LDKLogger_JCalls_free) {
12489 // If this_arg is a JCalls struct, then we need to increment the refcnt in it.
12490 LDKLogger_JCalls_clone(logger_conv.this_arg);
12492 LDKNetworkGraph network_graph_conv;
12493 network_graph_conv.inner = (void*)(network_graph & (~1));
12494 network_graph_conv.is_owned = (network_graph & 1) || (network_graph == 0);
12495 // Warning: we may need a move here but can't clone!
12496 LDKNetGraphMsgHandler ret = NetGraphMsgHandler_from_net_graph(chain_access_conv, logger_conv, network_graph_conv);
12497 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12500 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12501 LDKNetGraphMsgHandler this_arg_conv;
12502 this_arg_conv.inner = (void*)(this_arg & (~1));
12503 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12504 LDKLockedNetworkGraph ret = NetGraphMsgHandler_read_locked_graph(&this_arg_conv);
12505 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
12509 LDKLockedNetworkGraph this_arg_conv;
12510 this_arg_conv.inner = (void*)(this_arg & (~1));
12511 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12512 LDKNetworkGraph ret = LockedNetworkGraph_graph(&this_arg_conv);
12513 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12516 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
12517 LDKNetGraphMsgHandler this_arg_conv;
12518 this_arg_conv.inner = (void*)(this_arg & (~1));
12519 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
12520 LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
12521 *ret = NetGraphMsgHandler_as_RoutingMessageHandler(&this_arg_conv);
12525 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12526 LDKDirectionalChannelInfo this_ptr_conv;
12527 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12528 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12529 DirectionalChannelInfo_free(this_ptr_conv);
12532 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12533 LDKDirectionalChannelInfo this_ptr_conv;
12534 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12535 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12536 jint ret_val = DirectionalChannelInfo_get_last_update(&this_ptr_conv);
12540 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12541 LDKDirectionalChannelInfo this_ptr_conv;
12542 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12543 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12544 DirectionalChannelInfo_set_last_update(&this_ptr_conv, val);
12547 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
12548 LDKDirectionalChannelInfo this_ptr_conv;
12549 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12550 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12551 jboolean ret_val = DirectionalChannelInfo_get_enabled(&this_ptr_conv);
12555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
12556 LDKDirectionalChannelInfo this_ptr_conv;
12557 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12558 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12559 DirectionalChannelInfo_set_enabled(&this_ptr_conv, val);
12562 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
12563 LDKDirectionalChannelInfo this_ptr_conv;
12564 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12565 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12566 jshort ret_val = DirectionalChannelInfo_get_cltv_expiry_delta(&this_ptr_conv);
12570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
12571 LDKDirectionalChannelInfo this_ptr_conv;
12572 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12573 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12574 DirectionalChannelInfo_set_cltv_expiry_delta(&this_ptr_conv, val);
12577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12578 LDKDirectionalChannelInfo this_ptr_conv;
12579 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12580 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12581 jlong ret_val = DirectionalChannelInfo_get_htlc_minimum_msat(&this_ptr_conv);
12585 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12586 LDKDirectionalChannelInfo this_ptr_conv;
12587 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12588 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12589 DirectionalChannelInfo_set_htlc_minimum_msat(&this_ptr_conv, val);
12592 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12593 LDKDirectionalChannelInfo this_ptr_conv;
12594 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12595 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12596 LDKChannelUpdate ret = DirectionalChannelInfo_get_last_update_message(&this_ptr_conv);
12597 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12600 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12601 LDKDirectionalChannelInfo this_ptr_conv;
12602 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12603 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12604 LDKChannelUpdate val_conv;
12605 val_conv.inner = (void*)(val & (~1));
12606 val_conv.is_owned = (val & 1) || (val == 0);
12607 if (val_conv.inner != NULL)
12608 val_conv = ChannelUpdate_clone(&val_conv);
12609 DirectionalChannelInfo_set_last_update_message(&this_ptr_conv, val_conv);
12612 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12613 LDKDirectionalChannelInfo obj_conv;
12614 obj_conv.inner = (void*)(obj & (~1));
12615 obj_conv.is_owned = (obj & 1) || (obj == 0);
12616 LDKCVec_u8Z arg_var = DirectionalChannelInfo_write(&obj_conv);
12617 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12618 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12622 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12623 LDKu8slice ser_ref;
12624 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12625 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12626 LDKDirectionalChannelInfo ret = DirectionalChannelInfo_read(ser_ref);
12627 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12628 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12631 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12632 LDKChannelInfo this_ptr_conv;
12633 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12634 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12635 ChannelInfo_free(this_ptr_conv);
12638 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12639 LDKChannelInfo this_ptr_conv;
12640 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12641 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12642 LDKChannelFeatures ret = ChannelInfo_get_features(&this_ptr_conv);
12643 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12646 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12647 LDKChannelInfo this_ptr_conv;
12648 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12649 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12650 LDKChannelFeatures val_conv;
12651 val_conv.inner = (void*)(val & (~1));
12652 val_conv.is_owned = (val & 1) || (val == 0);
12653 // Warning: we may need a move here but can't clone!
12654 ChannelInfo_set_features(&this_ptr_conv, val_conv);
12657 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12658 LDKChannelInfo this_ptr_conv;
12659 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12660 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12661 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12662 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_one(&this_ptr_conv).compressed_form);
12666 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12667 LDKChannelInfo this_ptr_conv;
12668 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12669 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12670 LDKPublicKey val_ref;
12671 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12672 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12673 ChannelInfo_set_node_one(&this_ptr_conv, val_ref);
12676 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12677 LDKChannelInfo this_ptr_conv;
12678 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12679 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12680 LDKDirectionalChannelInfo ret = ChannelInfo_get_one_to_two(&this_ptr_conv);
12681 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12684 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12685 LDKChannelInfo this_ptr_conv;
12686 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12687 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12688 LDKDirectionalChannelInfo val_conv;
12689 val_conv.inner = (void*)(val & (~1));
12690 val_conv.is_owned = (val & 1) || (val == 0);
12691 // Warning: we may need a move here but can't clone!
12692 ChannelInfo_set_one_to_two(&this_ptr_conv, val_conv);
12695 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
12696 LDKChannelInfo this_ptr_conv;
12697 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12698 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12699 jbyteArray arg_arr = (*_env)->NewByteArray(_env, 33);
12700 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, 33, ChannelInfo_get_node_two(&this_ptr_conv).compressed_form);
12704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12705 LDKChannelInfo this_ptr_conv;
12706 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12707 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12708 LDKPublicKey val_ref;
12709 CHECK((*_env)->GetArrayLength (_env, val) == 33);
12710 (*_env)->GetByteArrayRegion (_env, val, 0, 33, val_ref.compressed_form);
12711 ChannelInfo_set_node_two(&this_ptr_conv, val_ref);
12714 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
12715 LDKChannelInfo this_ptr_conv;
12716 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12717 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12718 LDKDirectionalChannelInfo ret = ChannelInfo_get_two_to_one(&this_ptr_conv);
12719 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12723 LDKChannelInfo this_ptr_conv;
12724 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12725 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12726 LDKDirectionalChannelInfo val_conv;
12727 val_conv.inner = (void*)(val & (~1));
12728 val_conv.is_owned = (val & 1) || (val == 0);
12729 // Warning: we may need a move here but can't clone!
12730 ChannelInfo_set_two_to_one(&this_ptr_conv, val_conv);
12733 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12734 LDKChannelInfo this_ptr_conv;
12735 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12736 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12737 LDKChannelAnnouncement ret = ChannelInfo_get_announcement_message(&this_ptr_conv);
12738 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12741 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12742 LDKChannelInfo this_ptr_conv;
12743 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12744 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12745 LDKChannelAnnouncement val_conv;
12746 val_conv.inner = (void*)(val & (~1));
12747 val_conv.is_owned = (val & 1) || (val == 0);
12748 if (val_conv.inner != NULL)
12749 val_conv = ChannelAnnouncement_clone(&val_conv);
12750 ChannelInfo_set_announcement_message(&this_ptr_conv, val_conv);
12753 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12754 LDKChannelInfo obj_conv;
12755 obj_conv.inner = (void*)(obj & (~1));
12756 obj_conv.is_owned = (obj & 1) || (obj == 0);
12757 LDKCVec_u8Z arg_var = ChannelInfo_write(&obj_conv);
12758 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12759 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12763 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12764 LDKu8slice ser_ref;
12765 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12766 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12767 LDKChannelInfo ret = ChannelInfo_read(ser_ref);
12768 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12769 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12773 LDKRoutingFees this_ptr_conv;
12774 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12775 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12776 RoutingFees_free(this_ptr_conv);
12779 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1clone(JNIEnv * _env, jclass _b, jlong orig) {
12780 LDKRoutingFees orig_conv;
12781 orig_conv.inner = (void*)(orig & (~1));
12782 orig_conv.is_owned = (orig & 1) || (orig == 0);
12783 LDKRoutingFees ret = RoutingFees_clone(&orig_conv);
12784 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12787 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
12788 LDKRoutingFees this_ptr_conv;
12789 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12790 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12791 jint ret_val = RoutingFees_get_base_msat(&this_ptr_conv);
12795 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12796 LDKRoutingFees this_ptr_conv;
12797 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12798 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12799 RoutingFees_set_base_msat(&this_ptr_conv, val);
12802 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
12803 LDKRoutingFees this_ptr_conv;
12804 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12805 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12806 jint ret_val = RoutingFees_get_proportional_millionths(&this_ptr_conv);
12810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12811 LDKRoutingFees this_ptr_conv;
12812 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12813 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12814 RoutingFees_set_proportional_millionths(&this_ptr_conv, val);
12817 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
12818 LDKRoutingFees ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
12819 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
12823 LDKu8slice ser_ref;
12824 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
12825 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
12826 LDKRoutingFees ret = RoutingFees_read(ser_ref);
12827 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
12828 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12831 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
12832 LDKRoutingFees obj_conv;
12833 obj_conv.inner = (void*)(obj & (~1));
12834 obj_conv.is_owned = (obj & 1) || (obj == 0);
12835 LDKCVec_u8Z arg_var = RoutingFees_write(&obj_conv);
12836 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
12837 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
12841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
12842 LDKNodeAnnouncementInfo this_ptr_conv;
12843 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12844 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12845 NodeAnnouncementInfo_free(this_ptr_conv);
12848 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
12849 LDKNodeAnnouncementInfo this_ptr_conv;
12850 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12851 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12852 LDKNodeFeatures ret = NodeAnnouncementInfo_get_features(&this_ptr_conv);
12853 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12856 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12857 LDKNodeAnnouncementInfo this_ptr_conv;
12858 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12859 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12860 LDKNodeFeatures val_conv;
12861 val_conv.inner = (void*)(val & (~1));
12862 val_conv.is_owned = (val & 1) || (val == 0);
12863 // Warning: we may need a move here but can't clone!
12864 NodeAnnouncementInfo_set_features(&this_ptr_conv, val_conv);
12867 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
12868 LDKNodeAnnouncementInfo this_ptr_conv;
12869 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12870 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12871 jint ret_val = NodeAnnouncementInfo_get_last_update(&this_ptr_conv);
12875 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
12876 LDKNodeAnnouncementInfo this_ptr_conv;
12877 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12878 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12879 NodeAnnouncementInfo_set_last_update(&this_ptr_conv, val);
12882 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
12883 LDKNodeAnnouncementInfo this_ptr_conv;
12884 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12885 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12886 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
12887 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(&this_ptr_conv));
12891 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12892 LDKNodeAnnouncementInfo this_ptr_conv;
12893 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12894 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12895 LDKThreeBytes val_ref;
12896 CHECK((*_env)->GetArrayLength (_env, val) == 3);
12897 (*_env)->GetByteArrayRegion (_env, val, 0, 3, val_ref.data);
12898 NodeAnnouncementInfo_set_rgb(&this_ptr_conv, val_ref);
12901 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
12902 LDKNodeAnnouncementInfo this_ptr_conv;
12903 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12904 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12905 jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
12906 (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(&this_ptr_conv));
12910 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jbyteArray val) {
12911 LDKNodeAnnouncementInfo this_ptr_conv;
12912 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12913 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12914 LDKThirtyTwoBytes val_ref;
12915 CHECK((*_env)->GetArrayLength (_env, val) == 32);
12916 (*_env)->GetByteArrayRegion (_env, val, 0, 32, val_ref.data);
12917 NodeAnnouncementInfo_set_alias(&this_ptr_conv, val_ref);
12920 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
12921 LDKNodeAnnouncementInfo this_ptr_conv;
12922 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12923 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12924 LDKCVec_NetAddressZ val_constr;
12925 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
12926 if (val_constr.datalen > 0)
12927 val_constr.data = MALLOC(val_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12929 val_constr.data = NULL;
12930 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
12931 for (size_t m = 0; m < val_constr.datalen; m++) {
12932 long arr_conv_12 = val_vals[m];
12933 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12934 FREE((void*)arr_conv_12);
12935 val_constr.data[m] = arr_conv_12_conv;
12937 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
12938 NodeAnnouncementInfo_set_addresses(&this_ptr_conv, val_constr);
12941 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr) {
12942 LDKNodeAnnouncementInfo this_ptr_conv;
12943 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12944 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12945 LDKNodeAnnouncement ret = NodeAnnouncementInfo_get_announcement_message(&this_ptr_conv);
12946 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1announcement_1message(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
12950 LDKNodeAnnouncementInfo this_ptr_conv;
12951 this_ptr_conv.inner = (void*)(this_ptr & (~1));
12952 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
12953 LDKNodeAnnouncement val_conv;
12954 val_conv.inner = (void*)(val & (~1));
12955 val_conv.is_owned = (val & 1) || (val == 0);
12956 if (val_conv.inner != NULL)
12957 val_conv = NodeAnnouncement_clone(&val_conv);
12958 NodeAnnouncementInfo_set_announcement_message(&this_ptr_conv, val_conv);
12961 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, jlongArray addresses_arg, jlong announcement_message_arg) {
12962 LDKNodeFeatures features_arg_conv;
12963 features_arg_conv.inner = (void*)(features_arg & (~1));
12964 features_arg_conv.is_owned = (features_arg & 1) || (features_arg == 0);
12965 // Warning: we may need a move here but can't clone!
12966 LDKThreeBytes rgb_arg_ref;
12967 CHECK((*_env)->GetArrayLength (_env, rgb_arg) == 3);
12968 (*_env)->GetByteArrayRegion (_env, rgb_arg, 0, 3, rgb_arg_ref.data);
12969 LDKThirtyTwoBytes alias_arg_ref;
12970 CHECK((*_env)->GetArrayLength (_env, alias_arg) == 32);
12971 (*_env)->GetByteArrayRegion (_env, alias_arg, 0, 32, alias_arg_ref.data);
12972 LDKCVec_NetAddressZ addresses_arg_constr;
12973 addresses_arg_constr.datalen = (*_env)->GetArrayLength (_env, addresses_arg);
12974 if (addresses_arg_constr.datalen > 0)
12975 addresses_arg_constr.data = MALLOC(addresses_arg_constr.datalen * sizeof(LDKNetAddress), "LDKCVec_NetAddressZ Elements");
12977 addresses_arg_constr.data = NULL;
12978 long* addresses_arg_vals = (*_env)->GetLongArrayElements (_env, addresses_arg, NULL);
12979 for (size_t m = 0; m < addresses_arg_constr.datalen; m++) {
12980 long arr_conv_12 = addresses_arg_vals[m];
12981 LDKNetAddress arr_conv_12_conv = *(LDKNetAddress*)arr_conv_12;
12982 FREE((void*)arr_conv_12);
12983 addresses_arg_constr.data[m] = arr_conv_12_conv;
12985 (*_env)->ReleaseLongArrayElements (_env, addresses_arg, addresses_arg_vals, 0);
12986 LDKNodeAnnouncement announcement_message_arg_conv;
12987 announcement_message_arg_conv.inner = (void*)(announcement_message_arg & (~1));
12988 announcement_message_arg_conv.is_owned = (announcement_message_arg & 1) || (announcement_message_arg == 0);
12989 if (announcement_message_arg_conv.inner != NULL)
12990 announcement_message_arg_conv = NodeAnnouncement_clone(&announcement_message_arg_conv);
12991 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_new(features_arg_conv, last_update_arg, rgb_arg_ref, alias_arg_ref, addresses_arg_constr, announcement_message_arg_conv);
12992 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
12995 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
12996 LDKNodeAnnouncementInfo obj_conv;
12997 obj_conv.inner = (void*)(obj & (~1));
12998 obj_conv.is_owned = (obj & 1) || (obj == 0);
12999 LDKCVec_u8Z arg_var = NodeAnnouncementInfo_write(&obj_conv);
13000 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13001 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13005 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13006 LDKu8slice ser_ref;
13007 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13008 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13009 LDKNodeAnnouncementInfo ret = NodeAnnouncementInfo_read(ser_ref);
13010 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13011 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13014 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
13015 LDKNodeInfo this_ptr_conv;
13016 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13017 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13018 NodeInfo_free(this_ptr_conv);
13021 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlongArray val) {
13022 LDKNodeInfo this_ptr_conv;
13023 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13024 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13025 LDKCVec_u64Z val_constr;
13026 val_constr.datalen = (*_env)->GetArrayLength (_env, val);
13027 if (val_constr.datalen > 0)
13028 val_constr.data = MALLOC(val_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13030 val_constr.data = NULL;
13031 long* val_vals = (*_env)->GetLongArrayElements (_env, val, NULL);
13032 for (size_t g = 0; g < val_constr.datalen; g++) {
13033 long arr_conv_6 = val_vals[g];
13034 val_constr.data[g] = arr_conv_6;
13036 (*_env)->ReleaseLongArrayElements (_env, val, val_vals, 0);
13037 NodeInfo_set_channels(&this_ptr_conv, val_constr);
13040 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
13041 LDKNodeInfo this_ptr_conv;
13042 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13043 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13044 LDKRoutingFees ret = NodeInfo_get_lowest_inbound_channel_fees(&this_ptr_conv);
13045 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13049 LDKNodeInfo this_ptr_conv;
13050 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13051 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13052 LDKRoutingFees val_conv;
13053 val_conv.inner = (void*)(val & (~1));
13054 val_conv.is_owned = (val & 1) || (val == 0);
13055 if (val_conv.inner != NULL)
13056 val_conv = RoutingFees_clone(&val_conv);
13057 NodeInfo_set_lowest_inbound_channel_fees(&this_ptr_conv, val_conv);
13060 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
13061 LDKNodeInfo this_ptr_conv;
13062 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13063 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13064 LDKNodeAnnouncementInfo ret = NodeInfo_get_announcement_info(&this_ptr_conv);
13065 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13068 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
13069 LDKNodeInfo this_ptr_conv;
13070 this_ptr_conv.inner = (void*)(this_ptr & (~1));
13071 this_ptr_conv.is_owned = (this_ptr & 1) || (this_ptr == 0);
13072 LDKNodeAnnouncementInfo val_conv;
13073 val_conv.inner = (void*)(val & (~1));
13074 val_conv.is_owned = (val & 1) || (val == 0);
13075 // Warning: we may need a move here but can't clone!
13076 NodeInfo_set_announcement_info(&this_ptr_conv, val_conv);
13079 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, jclass _b, jlongArray channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
13080 LDKCVec_u64Z channels_arg_constr;
13081 channels_arg_constr.datalen = (*_env)->GetArrayLength (_env, channels_arg);
13082 if (channels_arg_constr.datalen > 0)
13083 channels_arg_constr.data = MALLOC(channels_arg_constr.datalen * sizeof(jlong), "LDKCVec_u64Z Elements");
13085 channels_arg_constr.data = NULL;
13086 long* channels_arg_vals = (*_env)->GetLongArrayElements (_env, channels_arg, NULL);
13087 for (size_t g = 0; g < channels_arg_constr.datalen; g++) {
13088 long arr_conv_6 = channels_arg_vals[g];
13089 channels_arg_constr.data[g] = arr_conv_6;
13091 (*_env)->ReleaseLongArrayElements (_env, channels_arg, channels_arg_vals, 0);
13092 LDKRoutingFees lowest_inbound_channel_fees_arg_conv;
13093 lowest_inbound_channel_fees_arg_conv.inner = (void*)(lowest_inbound_channel_fees_arg & (~1));
13094 lowest_inbound_channel_fees_arg_conv.is_owned = (lowest_inbound_channel_fees_arg & 1) || (lowest_inbound_channel_fees_arg == 0);
13095 if (lowest_inbound_channel_fees_arg_conv.inner != NULL)
13096 lowest_inbound_channel_fees_arg_conv = RoutingFees_clone(&lowest_inbound_channel_fees_arg_conv);
13097 LDKNodeAnnouncementInfo announcement_info_arg_conv;
13098 announcement_info_arg_conv.inner = (void*)(announcement_info_arg & (~1));
13099 announcement_info_arg_conv.is_owned = (announcement_info_arg & 1) || (announcement_info_arg == 0);
13100 // Warning: we may need a move here but can't clone!
13101 LDKNodeInfo ret = NodeInfo_new(channels_arg_constr, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
13102 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13105 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
13106 LDKNodeInfo obj_conv;
13107 obj_conv.inner = (void*)(obj & (~1));
13108 obj_conv.is_owned = (obj & 1) || (obj == 0);
13109 LDKCVec_u8Z arg_var = NodeInfo_write(&obj_conv);
13110 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13111 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13115 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13116 LDKu8slice ser_ref;
13117 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13118 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13119 LDKNodeInfo ret = NodeInfo_read(ser_ref);
13120 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13121 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13124 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
13125 LDKNetworkGraph obj_conv;
13126 obj_conv.inner = (void*)(obj & (~1));
13127 obj_conv.is_owned = (obj & 1) || (obj == 0);
13128 LDKCVec_u8Z arg_var = NetworkGraph_write(&obj_conv);
13129 jbyteArray arg_arr = (*_env)->NewByteArray(_env, arg_var.datalen);
13130 (*_env)->SetByteArrayRegion(_env, arg_arr, 0, arg_var.datalen, arg_var.data);
13134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jbyteArray ser) {
13135 LDKu8slice ser_ref;
13136 ser_ref.data = (*_env)->GetByteArrayElements (_env, ser, NULL);
13137 ser_ref.datalen = (*_env)->GetArrayLength (_env, ser);
13138 LDKNetworkGraph ret = NetworkGraph_read(ser_ref);
13139 (*_env)->ReleaseByteArrayElements(_env, ser, (int8_t*)ser_ref.data, 0);
13140 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13143 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
13144 LDKNetworkGraph ret = NetworkGraph_new();
13145 return ((long)ret.inner) | (ret.is_owned ? 1 : 0);
13148 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) {
13149 LDKNetworkGraph this_arg_conv;
13150 this_arg_conv.inner = (void*)(this_arg & (~1));
13151 this_arg_conv.is_owned = (this_arg & 1) || (this_arg == 0);
13152 NetworkGraph_close_channel_from_update(&this_arg_conv, short_channel_id, is_permanent);