Convert unitary enums to Java enums
[ldk-java] / src / main / jni / bindings.c
1 #include "org_ldk_impl_bindings.h"
2 #include <rust_types.h>
3 #include <lightning.h>
4 #include <assert.h>
5 #include <string.h>
6 #include <stdatomic.h>
7
8 jmethodID ordinal_meth = NULL;
9 JNIEXPORT void Java_org_ldk_impl_bindings_init(JNIEnv * env, jclass _b, jclass enum_class) {
10         ordinal_meth = (*env)->GetMethodID(env, enum_class, "ordinal", "()I");
11         assert(ordinal_meth != NULL);
12 }
13
14 #include <threads.h>
15 static mtx_t allocation_mtx;
16
17 void __attribute__((constructor)) init_mtx() {
18         assert(mtx_init(&allocation_mtx, mtx_plain) == thrd_success);
19 }
20
21 typedef struct allocation {
22         struct allocation* next;
23         void* ptr;
24         const char* struct_name;
25 } allocation;
26 static allocation* allocation_ll = NULL;
27
28 void* MALLOC(size_t len, const char* struct_name) {
29         void* res = malloc(len);
30         allocation* new_alloc = malloc(sizeof(allocation));
31         new_alloc->ptr = res;
32         new_alloc->struct_name = struct_name;
33         assert(mtx_lock(&allocation_mtx) == thrd_success);
34         new_alloc->next = allocation_ll;
35         allocation_ll = new_alloc;
36         assert(mtx_unlock(&allocation_mtx) == thrd_success);
37         return res;
38 }
39
40 void FREE(void* ptr) {
41         allocation* p = NULL;
42         assert(mtx_lock(&allocation_mtx) == thrd_success);
43         allocation* it = allocation_ll;
44         while (it->ptr != ptr) { p = it; it = it->next; }
45         if (p) { p->next = it->next; } else { allocation_ll = it->next; }
46         assert(mtx_unlock(&allocation_mtx) == thrd_success);
47         assert(it->ptr == ptr);
48         free(it);
49         free(ptr);
50 }
51
52 void __attribute__((destructor)) check_leaks() {
53         for (allocation* a = allocation_ll; a != NULL; a = a->next) { fprintf(stderr, "%s %p remains\n", a->struct_name, a->ptr); }
54         assert(allocation_ll == NULL);
55 }
56
57 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LDKSecretKey_1new(JNIEnv * _env, jclass _b) {
58         LDKSecretKey* key = (LDKSecretKey*)MALLOC(sizeof(LDKSecretKey), "LDKSecretKey");
59         return (long)key;
60 }
61 static inline LDKChainError LDKChainError_from_java(JNIEnv *env, jclass val) {
62         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
63                 case 0: return LDKChainError_NotSupported;
64                 case 1: return LDKChainError_NotWatched;
65                 case 2: return LDKChainError_UnknownTx;
66         }
67         assert(false);
68 }
69 static inline jclass LDKChainError_to_java(JNIEnv *env, LDKChainError val) {
70         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
71         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKChainError;");
72         assert(enum_class != NULL);
73         switch (val) {
74                 case LDKChainError_NotSupported: {
75                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_NotSupported", "Lorg/ldk/impl/bindings$LDKChainError;");
76                         assert(field != NULL);
77                         return (*env)->GetStaticObjectField(env, enum_class, field);
78                 }
79                 case LDKChainError_NotWatched: {
80                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_NotWatched", "Lorg/ldk/impl/bindings$LDKChainError;");
81                         assert(field != NULL);
82                         return (*env)->GetStaticObjectField(env, enum_class, field);
83                 }
84                 case LDKChainError_UnknownTx: {
85                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChainError_UnknownTx", "Lorg/ldk/impl/bindings$LDKChainError;");
86                         assert(field != NULL);
87                         return (*env)->GetStaticObjectField(env, enum_class, field);
88                 }
89                 default: assert(false);
90         }
91 }
92
93 static inline LDKChannelMonitorUpdateErr LDKChannelMonitorUpdateErr_from_java(JNIEnv *env, jclass val) {
94         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
95                 case 0: return LDKChannelMonitorUpdateErr_TemporaryFailure;
96                 case 1: return LDKChannelMonitorUpdateErr_PermanentFailure;
97         }
98         assert(false);
99 }
100 static inline jclass LDKChannelMonitorUpdateErr_to_java(JNIEnv *env, LDKChannelMonitorUpdateErr val) {
101         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
102         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
103         assert(enum_class != NULL);
104         switch (val) {
105                 case LDKChannelMonitorUpdateErr_TemporaryFailure: {
106                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_TemporaryFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
107                         assert(field != NULL);
108                         return (*env)->GetStaticObjectField(env, enum_class, field);
109                 }
110                 case LDKChannelMonitorUpdateErr_PermanentFailure: {
111                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKChannelMonitorUpdateErr_PermanentFailure", "Lorg/ldk/impl/bindings$LDKChannelMonitorUpdateErr;");
112                         assert(field != NULL);
113                         return (*env)->GetStaticObjectField(env, enum_class, field);
114                 }
115                 default: assert(false);
116         }
117 }
118
119 static inline LDKConfirmationTarget LDKConfirmationTarget_from_java(JNIEnv *env, jclass val) {
120         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
121                 case 0: return LDKConfirmationTarget_Background;
122                 case 1: return LDKConfirmationTarget_Normal;
123                 case 2: return LDKConfirmationTarget_HighPriority;
124         }
125         assert(false);
126 }
127 static inline jclass LDKConfirmationTarget_to_java(JNIEnv *env, LDKConfirmationTarget val) {
128         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
129         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
130         assert(enum_class != NULL);
131         switch (val) {
132                 case LDKConfirmationTarget_Background: {
133                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Background", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
134                         assert(field != NULL);
135                         return (*env)->GetStaticObjectField(env, enum_class, field);
136                 }
137                 case LDKConfirmationTarget_Normal: {
138                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_Normal", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
139                         assert(field != NULL);
140                         return (*env)->GetStaticObjectField(env, enum_class, field);
141                 }
142                 case LDKConfirmationTarget_HighPriority: {
143                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKConfirmationTarget_HighPriority", "Lorg/ldk/impl/bindings$LDKConfirmationTarget;");
144                         assert(field != NULL);
145                         return (*env)->GetStaticObjectField(env, enum_class, field);
146                 }
147                 default: assert(false);
148         }
149 }
150
151 static inline LDKLevel LDKLevel_from_java(JNIEnv *env, jclass val) {
152         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
153                 case 0: return LDKLevel_Off;
154                 case 1: return LDKLevel_Error;
155                 case 2: return LDKLevel_Warn;
156                 case 3: return LDKLevel_Info;
157                 case 4: return LDKLevel_Debug;
158                 case 5: return LDKLevel_Trace;
159         }
160         assert(false);
161 }
162 static inline jclass LDKLevel_to_java(JNIEnv *env, LDKLevel val) {
163         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
164         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKLevel;");
165         assert(enum_class != NULL);
166         switch (val) {
167                 case LDKLevel_Off: {
168                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Off", "Lorg/ldk/impl/bindings$LDKLevel;");
169                         assert(field != NULL);
170                         return (*env)->GetStaticObjectField(env, enum_class, field);
171                 }
172                 case LDKLevel_Error: {
173                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Error", "Lorg/ldk/impl/bindings$LDKLevel;");
174                         assert(field != NULL);
175                         return (*env)->GetStaticObjectField(env, enum_class, field);
176                 }
177                 case LDKLevel_Warn: {
178                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Warn", "Lorg/ldk/impl/bindings$LDKLevel;");
179                         assert(field != NULL);
180                         return (*env)->GetStaticObjectField(env, enum_class, field);
181                 }
182                 case LDKLevel_Info: {
183                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Info", "Lorg/ldk/impl/bindings$LDKLevel;");
184                         assert(field != NULL);
185                         return (*env)->GetStaticObjectField(env, enum_class, field);
186                 }
187                 case LDKLevel_Debug: {
188                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Debug", "Lorg/ldk/impl/bindings$LDKLevel;");
189                         assert(field != NULL);
190                         return (*env)->GetStaticObjectField(env, enum_class, field);
191                 }
192                 case LDKLevel_Trace: {
193                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKLevel_Trace", "Lorg/ldk/impl/bindings$LDKLevel;");
194                         assert(field != NULL);
195                         return (*env)->GetStaticObjectField(env, enum_class, field);
196                 }
197                 default: assert(false);
198         }
199 }
200
201 static inline LDKNetwork LDKNetwork_from_java(JNIEnv *env, jclass val) {
202         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
203                 case 0: return LDKNetwork_Bitcoin;
204                 case 1: return LDKNetwork_Testnet;
205                 case 2: return LDKNetwork_Regtest;
206         }
207         assert(false);
208 }
209 static inline jclass LDKNetwork_to_java(JNIEnv *env, LDKNetwork val) {
210         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
211         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKNetwork;");
212         assert(enum_class != NULL);
213         switch (val) {
214                 case LDKNetwork_Bitcoin: {
215                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Bitcoin", "Lorg/ldk/impl/bindings$LDKNetwork;");
216                         assert(field != NULL);
217                         return (*env)->GetStaticObjectField(env, enum_class, field);
218                 }
219                 case LDKNetwork_Testnet: {
220                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Testnet", "Lorg/ldk/impl/bindings$LDKNetwork;");
221                         assert(field != NULL);
222                         return (*env)->GetStaticObjectField(env, enum_class, field);
223                 }
224                 case LDKNetwork_Regtest: {
225                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKNetwork_Regtest", "Lorg/ldk/impl/bindings$LDKNetwork;");
226                         assert(field != NULL);
227                         return (*env)->GetStaticObjectField(env, enum_class, field);
228                 }
229                 default: assert(false);
230         }
231 }
232
233 static inline LDKSecp256k1Error LDKSecp256k1Error_from_java(JNIEnv *env, jclass val) {
234         switch ((*env)->CallIntMethod(env, val, ordinal_meth)) {
235                 case 0: return LDKSecp256k1Error_IncorrectSignature;
236                 case 1: return LDKSecp256k1Error_InvalidMessage;
237                 case 2: return LDKSecp256k1Error_InvalidPublicKey;
238                 case 3: return LDKSecp256k1Error_InvalidSignature;
239                 case 4: return LDKSecp256k1Error_InvalidSecretKey;
240                 case 5: return LDKSecp256k1Error_InvalidRecoveryId;
241                 case 6: return LDKSecp256k1Error_InvalidTweak;
242                 case 7: return LDKSecp256k1Error_NotEnoughMemory;
243                 case 8: return LDKSecp256k1Error_CallbackPanicked;
244         }
245         assert(false);
246 }
247 static inline jclass LDKSecp256k1Error_to_java(JNIEnv *env, LDKSecp256k1Error val) {
248         // TODO: This is pretty inefficient, we really need to cache the field IDs and class
249         jclass enum_class = (*env)->FindClass(env, "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
250         assert(enum_class != NULL);
251         switch (val) {
252                 case LDKSecp256k1Error_IncorrectSignature: {
253                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_IncorrectSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
254                         assert(field != NULL);
255                         return (*env)->GetStaticObjectField(env, enum_class, field);
256                 }
257                 case LDKSecp256k1Error_InvalidMessage: {
258                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidMessage", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
259                         assert(field != NULL);
260                         return (*env)->GetStaticObjectField(env, enum_class, field);
261                 }
262                 case LDKSecp256k1Error_InvalidPublicKey: {
263                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidPublicKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
264                         assert(field != NULL);
265                         return (*env)->GetStaticObjectField(env, enum_class, field);
266                 }
267                 case LDKSecp256k1Error_InvalidSignature: {
268                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSignature", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
269                         assert(field != NULL);
270                         return (*env)->GetStaticObjectField(env, enum_class, field);
271                 }
272                 case LDKSecp256k1Error_InvalidSecretKey: {
273                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidSecretKey", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
274                         assert(field != NULL);
275                         return (*env)->GetStaticObjectField(env, enum_class, field);
276                 }
277                 case LDKSecp256k1Error_InvalidRecoveryId: {
278                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidRecoveryId", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
279                         assert(field != NULL);
280                         return (*env)->GetStaticObjectField(env, enum_class, field);
281                 }
282                 case LDKSecp256k1Error_InvalidTweak: {
283                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_InvalidTweak", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
284                         assert(field != NULL);
285                         return (*env)->GetStaticObjectField(env, enum_class, field);
286                 }
287                 case LDKSecp256k1Error_NotEnoughMemory: {
288                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_NotEnoughMemory", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
289                         assert(field != NULL);
290                         return (*env)->GetStaticObjectField(env, enum_class, field);
291                 }
292                 case LDKSecp256k1Error_CallbackPanicked: {
293                         jfieldID field = (*env)->GetStaticFieldID(env, enum_class, "LDKSecp256k1Error_CallbackPanicked", "Lorg/ldk/impl/bindings$LDKSecp256k1Error;");
294                         assert(field != NULL);
295                         return (*env)->GetStaticObjectField(env, enum_class, field);
296                 }
297                 default: assert(false);
298         }
299 }
300
301 typedef struct LDKMessageSendEventsProvider_JCalls {
302         atomic_size_t refcnt;
303         JNIEnv *env;
304         jobject o;
305         jmethodID get_and_clear_pending_msg_events_meth;
306 } LDKMessageSendEventsProvider_JCalls;
307 LDKCVec_MessageSendEventZ get_and_clear_pending_msg_events_jcall(const void* this_arg) {
308         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
309         LDKCVec_MessageSendEventZ* ret = (LDKCVec_MessageSendEventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_msg_events_meth);
310         LDKCVec_MessageSendEventZ res = *ret;
311         FREE(ret);
312         return res;
313 }
314 static void LDKMessageSendEventsProvider_JCalls_free(void* this_arg) {
315         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
316         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
317                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
318                 FREE(j_calls);
319         }
320 }
321 static void* LDKMessageSendEventsProvider_JCalls_clone(const void* this_arg) {
322         LDKMessageSendEventsProvider_JCalls *j_calls = (LDKMessageSendEventsProvider_JCalls*) this_arg;
323         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
324         return (void*) this_arg;
325 }
326 static inline LDKMessageSendEventsProvider LDKMessageSendEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
327         jclass c = (*env)->GetObjectClass(env, o);
328         assert(c != NULL);
329         LDKMessageSendEventsProvider_JCalls *calls = MALLOC(sizeof(LDKMessageSendEventsProvider_JCalls), "LDKMessageSendEventsProvider_JCalls");
330         atomic_init(&calls->refcnt, 1);
331         calls->env = env;
332         calls->o = (*env)->NewGlobalRef(env, o);
333         calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
334         assert(calls->get_and_clear_pending_msg_events_meth != NULL);
335
336         LDKMessageSendEventsProvider ret = {
337                 .this_arg = (void*) calls,
338                 .get_and_clear_pending_msg_events = get_and_clear_pending_msg_events_jcall,
339                 .free = LDKMessageSendEventsProvider_JCalls_free,
340         };
341         return ret;
342 }
343 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
344         LDKMessageSendEventsProvider *res_ptr = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
345         *res_ptr = LDKMessageSendEventsProvider_init(env, _a, o);
346         return (long)res_ptr;
347 }
348 typedef struct LDKEventsProvider_JCalls {
349         atomic_size_t refcnt;
350         JNIEnv *env;
351         jobject o;
352         jmethodID get_and_clear_pending_events_meth;
353 } LDKEventsProvider_JCalls;
354 LDKCVec_EventZ get_and_clear_pending_events_jcall(const void* this_arg) {
355         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
356         LDKCVec_EventZ* ret = (LDKCVec_EventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_events_meth);
357         LDKCVec_EventZ res = *ret;
358         FREE(ret);
359         return res;
360 }
361 static void LDKEventsProvider_JCalls_free(void* this_arg) {
362         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
363         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
364                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
365                 FREE(j_calls);
366         }
367 }
368 static void* LDKEventsProvider_JCalls_clone(const void* this_arg) {
369         LDKEventsProvider_JCalls *j_calls = (LDKEventsProvider_JCalls*) this_arg;
370         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
371         return (void*) this_arg;
372 }
373 static inline LDKEventsProvider LDKEventsProvider_init (JNIEnv * env, jclass _a, jobject o) {
374         jclass c = (*env)->GetObjectClass(env, o);
375         assert(c != NULL);
376         LDKEventsProvider_JCalls *calls = MALLOC(sizeof(LDKEventsProvider_JCalls), "LDKEventsProvider_JCalls");
377         atomic_init(&calls->refcnt, 1);
378         calls->env = env;
379         calls->o = (*env)->NewGlobalRef(env, o);
380         calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
381         assert(calls->get_and_clear_pending_events_meth != NULL);
382
383         LDKEventsProvider ret = {
384                 .this_arg = (void*) calls,
385                 .get_and_clear_pending_events = get_and_clear_pending_events_jcall,
386                 .free = LDKEventsProvider_JCalls_free,
387         };
388         return ret;
389 }
390 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv * env, jclass _a, jobject o) {
391         LDKEventsProvider *res_ptr = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
392         *res_ptr = LDKEventsProvider_init(env, _a, o);
393         return (long)res_ptr;
394 }
395 typedef struct LDKLogger_JCalls {
396         atomic_size_t refcnt;
397         JNIEnv *env;
398         jobject o;
399         jmethodID log_meth;
400 } LDKLogger_JCalls;
401 void log_jcall(const void* this_arg, const char *record) {
402         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
403         jstring record_conv = (*j_calls->env)->NewStringUTF(j_calls->env, record);
404         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->log_meth, record_conv);
405 }
406 static void LDKLogger_JCalls_free(void* this_arg) {
407         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
408         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
409                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
410                 FREE(j_calls);
411         }
412 }
413 static void* LDKLogger_JCalls_clone(const void* this_arg) {
414         LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
415         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
416         return (void*) this_arg;
417 }
418 static inline LDKLogger LDKLogger_init (JNIEnv * env, jclass _a, jobject o) {
419         jclass c = (*env)->GetObjectClass(env, o);
420         assert(c != NULL);
421         LDKLogger_JCalls *calls = MALLOC(sizeof(LDKLogger_JCalls), "LDKLogger_JCalls");
422         atomic_init(&calls->refcnt, 1);
423         calls->env = env;
424         calls->o = (*env)->NewGlobalRef(env, o);
425         calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
426         assert(calls->log_meth != NULL);
427
428         LDKLogger ret = {
429                 .this_arg = (void*) calls,
430                 .log = log_jcall,
431                 .free = LDKLogger_JCalls_free,
432         };
433         return ret;
434 }
435 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env, jclass _a, jobject o) {
436         LDKLogger *res_ptr = MALLOC(sizeof(LDKLogger), "LDKLogger");
437         *res_ptr = LDKLogger_init(env, _a, o);
438         return (long)res_ptr;
439 }
440 typedef struct LDKChainWatchInterface_JCalls {
441         atomic_size_t refcnt;
442         JNIEnv *env;
443         jobject o;
444         jmethodID install_watch_tx_meth;
445         jmethodID install_watch_outpoint_meth;
446         jmethodID watch_all_txn_meth;
447         jmethodID get_chain_utxo_meth;
448         jmethodID filter_block_meth;
449         jmethodID reentered_meth;
450 } LDKChainWatchInterface_JCalls;
451 void install_watch_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key) {
452         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
453         jbyteArray txid_arr = (*j_calls->env)->NewByteArray(j_calls->env, 32);
454         (*j_calls->env)->SetByteArrayRegion(j_calls->env, txid_arr, 0, 32, *txid);
455         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_tx_meth, txid_arr, script_pub_key);
456 }
457 void install_watch_outpoint_jcall(const void* this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script) {
458         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
459         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_outpoint_meth, outpoint, out_script);
460 }
461 void watch_all_txn_jcall(const void* this_arg) {
462         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
463         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->watch_all_txn_meth);
464 }
465 LDKCResult_C2Tuple_Scriptu64ZChainErrorZ get_chain_utxo_jcall(const void* this_arg, LDKThirtyTwoBytes genesis_hash, uint64_t unspent_tx_output_identifier) {
466         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
467         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = (LDKCResult_C2Tuple_Scriptu64ZChainErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_chain_utxo_meth, genesis_hash, unspent_tx_output_identifier);
468         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ res = *ret;
469         FREE(ret);
470         return res;
471 }
472 LDKCVec_usizeZ filter_block_jcall(const void* this_arg, LDKu8slice block) {
473         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
474         LDKCVec_usizeZ* ret = (LDKCVec_usizeZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->filter_block_meth, block);
475         LDKCVec_usizeZ res = *ret;
476         FREE(ret);
477         return res;
478 }
479 uintptr_t reentered_jcall(const void* this_arg) {
480         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
481         uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->reentered_meth);
482         uintptr_t res = *ret;
483         FREE(ret);
484         return res;
485 }
486 static void LDKChainWatchInterface_JCalls_free(void* this_arg) {
487         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
488         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
489                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
490                 FREE(j_calls);
491         }
492 }
493 static void* LDKChainWatchInterface_JCalls_clone(const void* this_arg) {
494         LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
495         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
496         return (void*) this_arg;
497 }
498 static inline LDKChainWatchInterface LDKChainWatchInterface_init (JNIEnv * env, jclass _a, jobject o) {
499         jclass c = (*env)->GetObjectClass(env, o);
500         assert(c != NULL);
501         LDKChainWatchInterface_JCalls *calls = MALLOC(sizeof(LDKChainWatchInterface_JCalls), "LDKChainWatchInterface_JCalls");
502         atomic_init(&calls->refcnt, 1);
503         calls->env = env;
504         calls->o = (*env)->NewGlobalRef(env, o);
505         calls->install_watch_tx_meth = (*env)->GetMethodID(env, c, "install_watch_tx", "([BJ)V");
506         assert(calls->install_watch_tx_meth != NULL);
507         calls->install_watch_outpoint_meth = (*env)->GetMethodID(env, c, "install_watch_outpoint", "(JJ)V");
508         assert(calls->install_watch_outpoint_meth != NULL);
509         calls->watch_all_txn_meth = (*env)->GetMethodID(env, c, "watch_all_txn", "()V");
510         assert(calls->watch_all_txn_meth != NULL);
511         calls->get_chain_utxo_meth = (*env)->GetMethodID(env, c, "get_chain_utxo", "(JJ)J");
512         assert(calls->get_chain_utxo_meth != NULL);
513         calls->filter_block_meth = (*env)->GetMethodID(env, c, "filter_block", "(J)J");
514         assert(calls->filter_block_meth != NULL);
515         calls->reentered_meth = (*env)->GetMethodID(env, c, "reentered", "()J");
516         assert(calls->reentered_meth != NULL);
517
518         LDKChainWatchInterface ret = {
519                 .this_arg = (void*) calls,
520                 .install_watch_tx = install_watch_tx_jcall,
521                 .install_watch_outpoint = install_watch_outpoint_jcall,
522                 .watch_all_txn = watch_all_txn_jcall,
523                 .get_chain_utxo = get_chain_utxo_jcall,
524                 .filter_block = filter_block_jcall,
525                 .reentered = reentered_jcall,
526                 .free = LDKChainWatchInterface_JCalls_free,
527         };
528         return ret;
529 }
530 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainWatchInterface_1new (JNIEnv * env, jclass _a, jobject o) {
531         LDKChainWatchInterface *res_ptr = MALLOC(sizeof(LDKChainWatchInterface), "LDKChainWatchInterface");
532         *res_ptr = LDKChainWatchInterface_init(env, _a, o);
533         return (long)res_ptr;
534 }
535 typedef struct LDKBroadcasterInterface_JCalls {
536         atomic_size_t refcnt;
537         JNIEnv *env;
538         jobject o;
539         jmethodID broadcast_transaction_meth;
540 } LDKBroadcasterInterface_JCalls;
541 void broadcast_transaction_jcall(const void* this_arg, LDKTransaction tx) {
542         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
543         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->broadcast_transaction_meth, tx);
544 }
545 static void LDKBroadcasterInterface_JCalls_free(void* this_arg) {
546         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
547         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
548                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
549                 FREE(j_calls);
550         }
551 }
552 static void* LDKBroadcasterInterface_JCalls_clone(const void* this_arg) {
553         LDKBroadcasterInterface_JCalls *j_calls = (LDKBroadcasterInterface_JCalls*) this_arg;
554         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
555         return (void*) this_arg;
556 }
557 static inline LDKBroadcasterInterface LDKBroadcasterInterface_init (JNIEnv * env, jclass _a, jobject o) {
558         jclass c = (*env)->GetObjectClass(env, o);
559         assert(c != NULL);
560         LDKBroadcasterInterface_JCalls *calls = MALLOC(sizeof(LDKBroadcasterInterface_JCalls), "LDKBroadcasterInterface_JCalls");
561         atomic_init(&calls->refcnt, 1);
562         calls->env = env;
563         calls->o = (*env)->NewGlobalRef(env, o);
564         calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
565         assert(calls->broadcast_transaction_meth != NULL);
566
567         LDKBroadcasterInterface ret = {
568                 .this_arg = (void*) calls,
569                 .broadcast_transaction = broadcast_transaction_jcall,
570                 .free = LDKBroadcasterInterface_JCalls_free,
571         };
572         return ret;
573 }
574 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (JNIEnv * env, jclass _a, jobject o) {
575         LDKBroadcasterInterface *res_ptr = MALLOC(sizeof(LDKBroadcasterInterface), "LDKBroadcasterInterface");
576         *res_ptr = LDKBroadcasterInterface_init(env, _a, o);
577         return (long)res_ptr;
578 }
579 typedef struct LDKChainListener_JCalls {
580         atomic_size_t refcnt;
581         JNIEnv *env;
582         jobject o;
583         jmethodID block_connected_meth;
584         jmethodID block_disconnected_meth;
585 } LDKChainListener_JCalls;
586 void block_connected_jcall(const void* this_arg, const uint8_t (*header)[80], uint32_t height, LDKCVec_TransactionZ txn_matched, LDKusizeslice indexes_of_txn_matched) {
587         LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
588         jbyteArray header_arr = (*j_calls->env)->NewByteArray(j_calls->env, 80);
589         (*j_calls->env)->SetByteArrayRegion(j_calls->env, header_arr, 0, 80, *header);
590         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_connected_meth, header_arr, height, txn_matched, indexes_of_txn_matched);
591 }
592 void block_disconnected_jcall(const void* this_arg, const uint8_t (*header)[80], uint32_t disconnected_height) {
593         LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
594         jbyteArray header_arr = (*j_calls->env)->NewByteArray(j_calls->env, 80);
595         (*j_calls->env)->SetByteArrayRegion(j_calls->env, header_arr, 0, 80, *header);
596         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_disconnected_meth, header_arr, disconnected_height);
597 }
598 static void LDKChainListener_JCalls_free(void* this_arg) {
599         LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
600         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
601                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
602                 FREE(j_calls);
603         }
604 }
605 static void* LDKChainListener_JCalls_clone(const void* this_arg) {
606         LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
607         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
608         return (void*) this_arg;
609 }
610 static inline LDKChainListener LDKChainListener_init (JNIEnv * env, jclass _a, jobject o) {
611         jclass c = (*env)->GetObjectClass(env, o);
612         assert(c != NULL);
613         LDKChainListener_JCalls *calls = MALLOC(sizeof(LDKChainListener_JCalls), "LDKChainListener_JCalls");
614         atomic_init(&calls->refcnt, 1);
615         calls->env = env;
616         calls->o = (*env)->NewGlobalRef(env, o);
617         calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BIJJ)V");
618         assert(calls->block_connected_meth != NULL);
619         calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
620         assert(calls->block_disconnected_meth != NULL);
621
622         LDKChainListener ret = {
623                 .this_arg = (void*) calls,
624                 .block_connected = block_connected_jcall,
625                 .block_disconnected = block_disconnected_jcall,
626                 .free = LDKChainListener_JCalls_free,
627         };
628         return ret;
629 }
630 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainListener_1new (JNIEnv * env, jclass _a, jobject o) {
631         LDKChainListener *res_ptr = MALLOC(sizeof(LDKChainListener), "LDKChainListener");
632         *res_ptr = LDKChainListener_init(env, _a, o);
633         return (long)res_ptr;
634 }
635 typedef struct LDKFeeEstimator_JCalls {
636         atomic_size_t refcnt;
637         JNIEnv *env;
638         jobject o;
639         jmethodID get_est_sat_per_1000_weight_meth;
640 } LDKFeeEstimator_JCalls;
641 uint32_t get_est_sat_per_1000_weight_jcall(const void* this_arg, LDKConfirmationTarget confirmation_target) {
642         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
643         jclass confirmation_target_conv = LDKConfirmationTarget_to_java(j_calls->env, confirmation_target);
644         return (*j_calls->env)->CallIntMethod(j_calls->env, j_calls->o, j_calls->get_est_sat_per_1000_weight_meth, confirmation_target_conv);
645 }
646 static void LDKFeeEstimator_JCalls_free(void* this_arg) {
647         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
648         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
649                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
650                 FREE(j_calls);
651         }
652 }
653 static void* LDKFeeEstimator_JCalls_clone(const void* this_arg) {
654         LDKFeeEstimator_JCalls *j_calls = (LDKFeeEstimator_JCalls*) this_arg;
655         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
656         return (void*) this_arg;
657 }
658 static inline LDKFeeEstimator LDKFeeEstimator_init (JNIEnv * env, jclass _a, jobject o) {
659         jclass c = (*env)->GetObjectClass(env, o);
660         assert(c != NULL);
661         LDKFeeEstimator_JCalls *calls = MALLOC(sizeof(LDKFeeEstimator_JCalls), "LDKFeeEstimator_JCalls");
662         atomic_init(&calls->refcnt, 1);
663         calls->env = env;
664         calls->o = (*env)->NewGlobalRef(env, o);
665         calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(Lorg/ldk/impl/bindings$LDKConfirmationTarget;)I");
666         assert(calls->get_est_sat_per_1000_weight_meth != NULL);
667
668         LDKFeeEstimator ret = {
669                 .this_arg = (void*) calls,
670                 .get_est_sat_per_1000_weight = get_est_sat_per_1000_weight_jcall,
671                 .free = LDKFeeEstimator_JCalls_free,
672         };
673         return ret;
674 }
675 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv * env, jclass _a, jobject o) {
676         LDKFeeEstimator *res_ptr = MALLOC(sizeof(LDKFeeEstimator), "LDKFeeEstimator");
677         *res_ptr = LDKFeeEstimator_init(env, _a, o);
678         return (long)res_ptr;
679 }
680 typedef struct LDKChannelKeys_JCalls {
681         atomic_size_t refcnt;
682         JNIEnv *env;
683         jobject o;
684         jmethodID get_per_commitment_point_meth;
685         jmethodID release_commitment_secret_meth;
686         jmethodID key_derivation_params_meth;
687         jmethodID sign_remote_commitment_meth;
688         jmethodID sign_local_commitment_meth;
689         jmethodID sign_local_commitment_htlc_transactions_meth;
690         jmethodID sign_justice_transaction_meth;
691         jmethodID sign_remote_htlc_transaction_meth;
692         jmethodID sign_closing_transaction_meth;
693         jmethodID sign_channel_announcement_meth;
694         jmethodID on_accept_meth;
695 } LDKChannelKeys_JCalls;
696 LDKPublicKey get_per_commitment_point_jcall(const void* this_arg, uint64_t idx) {
697         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
698         LDKPublicKey* ret = (LDKPublicKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_per_commitment_point_meth, idx);
699         LDKPublicKey res = *ret;
700         FREE(ret);
701         return res;
702 }
703 LDKThirtyTwoBytes release_commitment_secret_jcall(const void* this_arg, uint64_t idx) {
704         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
705         LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->release_commitment_secret_meth, idx);
706         LDKThirtyTwoBytes res = *ret;
707         FREE(ret);
708         return res;
709 }
710 LDKC2Tuple_u64u64Z key_derivation_params_jcall(const void* this_arg) {
711         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
712         LDKC2Tuple_u64u64Z* ret = (LDKC2Tuple_u64u64Z*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->key_derivation_params_meth);
713         LDKC2Tuple_u64u64Z res = *ret;
714         FREE(ret);
715         return res;
716 }
717 LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ sign_remote_commitment_jcall(const void* this_arg, uint32_t feerate_per_kw, LDKTransaction commitment_tx, const LDKPreCalculatedTxCreationKeys *keys, LDKCVec_HTLCOutputInCommitmentZ htlcs) {
718         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
719         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = (LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_remote_commitment_meth, feerate_per_kw, commitment_tx, keys, htlcs);
720         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ res = *ret;
721         FREE(ret);
722         return res;
723 }
724 LDKCResult_SignatureNoneZ sign_local_commitment_jcall(const void* this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx) {
725         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
726         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_local_commitment_meth, local_commitment_tx);
727         LDKCResult_SignatureNoneZ res = *ret;
728         FREE(ret);
729         return res;
730 }
731 LDKCResult_CVec_SignatureZNoneZ sign_local_commitment_htlc_transactions_jcall(const void* this_arg, const LDKLocalCommitmentTransaction *local_commitment_tx) {
732         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
733         LDKCResult_CVec_SignatureZNoneZ* ret = (LDKCResult_CVec_SignatureZNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_local_commitment_htlc_transactions_meth, local_commitment_tx);
734         LDKCResult_CVec_SignatureZNoneZ res = *ret;
735         FREE(ret);
736         return res;
737 }
738 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) {
739         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
740         jbyteArray per_commitment_key_arr = (*j_calls->env)->NewByteArray(j_calls->env, 32);
741         (*j_calls->env)->SetByteArrayRegion(j_calls->env, per_commitment_key_arr, 0, 32, *per_commitment_key);
742         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_justice_transaction_meth, justice_tx, input, amount, per_commitment_key_arr, htlc);
743         LDKCResult_SignatureNoneZ res = *ret;
744         FREE(ret);
745         return res;
746 }
747 LDKCResult_SignatureNoneZ sign_remote_htlc_transaction_jcall(const void* this_arg, LDKTransaction htlc_tx, uintptr_t input, uint64_t amount, LDKPublicKey per_commitment_point, const LDKHTLCOutputInCommitment *htlc) {
748         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
749         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_remote_htlc_transaction_meth, htlc_tx, input, amount, per_commitment_point, htlc);
750         LDKCResult_SignatureNoneZ res = *ret;
751         FREE(ret);
752         return res;
753 }
754 LDKCResult_SignatureNoneZ sign_closing_transaction_jcall(const void* this_arg, LDKTransaction closing_tx) {
755         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
756         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_closing_transaction_meth, closing_tx);
757         LDKCResult_SignatureNoneZ res = *ret;
758         FREE(ret);
759         return res;
760 }
761 LDKCResult_SignatureNoneZ sign_channel_announcement_jcall(const void* this_arg, const LDKUnsignedChannelAnnouncement *msg) {
762         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
763         LDKCResult_SignatureNoneZ* ret = (LDKCResult_SignatureNoneZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->sign_channel_announcement_meth, msg);
764         LDKCResult_SignatureNoneZ res = *ret;
765         FREE(ret);
766         return res;
767 }
768 void on_accept_jcall(void* this_arg, const LDKChannelPublicKeys *channel_points, uint16_t remote_to_self_delay, uint16_t local_to_self_delay) {
769         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
770         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->on_accept_meth, channel_points, remote_to_self_delay, local_to_self_delay);
771 }
772 static void LDKChannelKeys_JCalls_free(void* this_arg) {
773         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
774         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
775                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
776                 FREE(j_calls);
777         }
778 }
779 static void* LDKChannelKeys_JCalls_clone(const void* this_arg) {
780         LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
781         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
782         return (void*) this_arg;
783 }
784 static inline LDKChannelKeys LDKChannelKeys_init (JNIEnv * env, jclass _a, jobject o) {
785         jclass c = (*env)->GetObjectClass(env, o);
786         assert(c != NULL);
787         LDKChannelKeys_JCalls *calls = MALLOC(sizeof(LDKChannelKeys_JCalls), "LDKChannelKeys_JCalls");
788         atomic_init(&calls->refcnt, 1);
789         calls->env = env;
790         calls->o = (*env)->NewGlobalRef(env, o);
791         calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)J");
792         assert(calls->get_per_commitment_point_meth != NULL);
793         calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)J");
794         assert(calls->release_commitment_secret_meth != NULL);
795         calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
796         assert(calls->key_derivation_params_meth != NULL);
797         calls->sign_remote_commitment_meth = (*env)->GetMethodID(env, c, "sign_remote_commitment", "(IJJJ)J");
798         assert(calls->sign_remote_commitment_meth != NULL);
799         calls->sign_local_commitment_meth = (*env)->GetMethodID(env, c, "sign_local_commitment", "(J)J");
800         assert(calls->sign_local_commitment_meth != NULL);
801         calls->sign_local_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_local_commitment_htlc_transactions", "(J)J");
802         assert(calls->sign_local_commitment_htlc_transactions_meth != NULL);
803         calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
804         assert(calls->sign_justice_transaction_meth != NULL);
805         calls->sign_remote_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_remote_htlc_transaction", "(JJJJJ)J");
806         assert(calls->sign_remote_htlc_transaction_meth != NULL);
807         calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
808         assert(calls->sign_closing_transaction_meth != NULL);
809         calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
810         assert(calls->sign_channel_announcement_meth != NULL);
811         calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
812         assert(calls->on_accept_meth != NULL);
813
814         LDKChannelKeys ret = {
815                 .this_arg = (void*) calls,
816                 .get_per_commitment_point = get_per_commitment_point_jcall,
817                 .release_commitment_secret = release_commitment_secret_jcall,
818                 .key_derivation_params = key_derivation_params_jcall,
819                 .sign_remote_commitment = sign_remote_commitment_jcall,
820                 .sign_local_commitment = sign_local_commitment_jcall,
821                 .sign_local_commitment_htlc_transactions = sign_local_commitment_htlc_transactions_jcall,
822                 .sign_justice_transaction = sign_justice_transaction_jcall,
823                 .sign_remote_htlc_transaction = sign_remote_htlc_transaction_jcall,
824                 .sign_closing_transaction = sign_closing_transaction_jcall,
825                 .sign_channel_announcement = sign_channel_announcement_jcall,
826                 .on_accept = on_accept_jcall,
827                 .clone = LDKChannelKeys_JCalls_clone,
828                 .free = LDKChannelKeys_JCalls_free,
829         };
830         return ret;
831 }
832 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv * env, jclass _a, jobject o) {
833         LDKChannelKeys *res_ptr = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
834         *res_ptr = LDKChannelKeys_init(env, _a, o);
835         return (long)res_ptr;
836 }
837 typedef struct LDKKeysInterface_JCalls {
838         atomic_size_t refcnt;
839         JNIEnv *env;
840         jobject o;
841         jmethodID get_node_secret_meth;
842         jmethodID get_destination_script_meth;
843         jmethodID get_shutdown_pubkey_meth;
844         jmethodID get_channel_keys_meth;
845         jmethodID get_secure_random_bytes_meth;
846 } LDKKeysInterface_JCalls;
847 LDKSecretKey get_node_secret_jcall(const void* this_arg) {
848         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
849         LDKSecretKey* ret = (LDKSecretKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_node_secret_meth);
850         LDKSecretKey res = *ret;
851         FREE(ret);
852         return res;
853 }
854 LDKCVec_u8Z get_destination_script_jcall(const void* this_arg) {
855         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
856         LDKCVec_u8Z* ret = (LDKCVec_u8Z*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_destination_script_meth);
857         LDKCVec_u8Z res = *ret;
858         FREE(ret);
859         return res;
860 }
861 LDKPublicKey get_shutdown_pubkey_jcall(const void* this_arg) {
862         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
863         LDKPublicKey* ret = (LDKPublicKey*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_shutdown_pubkey_meth);
864         LDKPublicKey res = *ret;
865         FREE(ret);
866         return res;
867 }
868 LDKChannelKeys get_channel_keys_jcall(const void* this_arg, bool inbound, uint64_t channel_value_satoshis) {
869         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
870         LDKChannelKeys* ret = (LDKChannelKeys*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_channel_keys_meth, inbound, channel_value_satoshis);
871         LDKChannelKeys res = *ret;
872         FREE(ret);
873         return res;
874 }
875 LDKThirtyTwoBytes get_secure_random_bytes_jcall(const void* this_arg) {
876         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
877         LDKThirtyTwoBytes* ret = (LDKThirtyTwoBytes*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_secure_random_bytes_meth);
878         LDKThirtyTwoBytes res = *ret;
879         FREE(ret);
880         return res;
881 }
882 static void LDKKeysInterface_JCalls_free(void* this_arg) {
883         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
884         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
885                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
886                 FREE(j_calls);
887         }
888 }
889 static void* LDKKeysInterface_JCalls_clone(const void* this_arg) {
890         LDKKeysInterface_JCalls *j_calls = (LDKKeysInterface_JCalls*) this_arg;
891         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
892         return (void*) this_arg;
893 }
894 static inline LDKKeysInterface LDKKeysInterface_init (JNIEnv * env, jclass _a, jobject o) {
895         jclass c = (*env)->GetObjectClass(env, o);
896         assert(c != NULL);
897         LDKKeysInterface_JCalls *calls = MALLOC(sizeof(LDKKeysInterface_JCalls), "LDKKeysInterface_JCalls");
898         atomic_init(&calls->refcnt, 1);
899         calls->env = env;
900         calls->o = (*env)->NewGlobalRef(env, o);
901         calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
902         assert(calls->get_node_secret_meth != NULL);
903         calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
904         assert(calls->get_destination_script_meth != NULL);
905         calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()J");
906         assert(calls->get_shutdown_pubkey_meth != NULL);
907         calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
908         assert(calls->get_channel_keys_meth != NULL);
909         calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()J");
910         assert(calls->get_secure_random_bytes_meth != NULL);
911
912         LDKKeysInterface ret = {
913                 .this_arg = (void*) calls,
914                 .get_node_secret = get_node_secret_jcall,
915                 .get_destination_script = get_destination_script_jcall,
916                 .get_shutdown_pubkey = get_shutdown_pubkey_jcall,
917                 .get_channel_keys = get_channel_keys_jcall,
918                 .get_secure_random_bytes = get_secure_random_bytes_jcall,
919                 .free = LDKKeysInterface_JCalls_free,
920         };
921         return ret;
922 }
923 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv * env, jclass _a, jobject o) {
924         LDKKeysInterface *res_ptr = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
925         *res_ptr = LDKKeysInterface_init(env, _a, o);
926         return (long)res_ptr;
927 }
928 typedef struct LDKManyChannelMonitor_JCalls {
929         atomic_size_t refcnt;
930         JNIEnv *env;
931         jobject o;
932         jmethodID add_monitor_meth;
933         jmethodID update_monitor_meth;
934         jmethodID get_and_clear_pending_monitor_events_meth;
935 } LDKManyChannelMonitor_JCalls;
936 LDKCResult_NoneChannelMonitorUpdateErrZ add_monitor_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitor monitor) {
937         LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg;
938         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->add_monitor_meth, funding_txo, monitor);
939         LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
940         FREE(ret);
941         return res;
942 }
943 LDKCResult_NoneChannelMonitorUpdateErrZ update_monitor_jcall(const void* this_arg, LDKOutPoint funding_txo, LDKChannelMonitorUpdate monitor) {
944         LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg;
945         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = (LDKCResult_NoneChannelMonitorUpdateErrZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->update_monitor_meth, funding_txo, monitor);
946         LDKCResult_NoneChannelMonitorUpdateErrZ res = *ret;
947         FREE(ret);
948         return res;
949 }
950 LDKCVec_MonitorEventZ get_and_clear_pending_monitor_events_jcall(const void* this_arg) {
951         LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg;
952         LDKCVec_MonitorEventZ* ret = (LDKCVec_MonitorEventZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_and_clear_pending_monitor_events_meth);
953         LDKCVec_MonitorEventZ res = *ret;
954         FREE(ret);
955         return res;
956 }
957 static void LDKManyChannelMonitor_JCalls_free(void* this_arg) {
958         LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg;
959         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
960                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
961                 FREE(j_calls);
962         }
963 }
964 static void* LDKManyChannelMonitor_JCalls_clone(const void* this_arg) {
965         LDKManyChannelMonitor_JCalls *j_calls = (LDKManyChannelMonitor_JCalls*) this_arg;
966         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
967         return (void*) this_arg;
968 }
969 static inline LDKManyChannelMonitor LDKManyChannelMonitor_init (JNIEnv * env, jclass _a, jobject o) {
970         jclass c = (*env)->GetObjectClass(env, o);
971         assert(c != NULL);
972         LDKManyChannelMonitor_JCalls *calls = MALLOC(sizeof(LDKManyChannelMonitor_JCalls), "LDKManyChannelMonitor_JCalls");
973         atomic_init(&calls->refcnt, 1);
974         calls->env = env;
975         calls->o = (*env)->NewGlobalRef(env, o);
976         calls->add_monitor_meth = (*env)->GetMethodID(env, c, "add_monitor", "(JJ)J");
977         assert(calls->add_monitor_meth != NULL);
978         calls->update_monitor_meth = (*env)->GetMethodID(env, c, "update_monitor", "(JJ)J");
979         assert(calls->update_monitor_meth != NULL);
980         calls->get_and_clear_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_monitor_events", "()J");
981         assert(calls->get_and_clear_pending_monitor_events_meth != NULL);
982
983         LDKManyChannelMonitor ret = {
984                 .this_arg = (void*) calls,
985                 .add_monitor = add_monitor_jcall,
986                 .update_monitor = update_monitor_jcall,
987                 .get_and_clear_pending_monitor_events = get_and_clear_pending_monitor_events_jcall,
988                 .free = LDKManyChannelMonitor_JCalls_free,
989         };
990         return ret;
991 }
992 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKManyChannelMonitor_1new (JNIEnv * env, jclass _a, jobject o) {
993         LDKManyChannelMonitor *res_ptr = MALLOC(sizeof(LDKManyChannelMonitor), "LDKManyChannelMonitor");
994         *res_ptr = LDKManyChannelMonitor_init(env, _a, o);
995         return (long)res_ptr;
996 }
997 typedef struct LDKChannelMessageHandler_JCalls {
998         atomic_size_t refcnt;
999         JNIEnv *env;
1000         jobject o;
1001         LDKMessageSendEventsProvider_JCalls* MessageSendEventsProvider;
1002         jmethodID handle_open_channel_meth;
1003         jmethodID handle_accept_channel_meth;
1004         jmethodID handle_funding_created_meth;
1005         jmethodID handle_funding_signed_meth;
1006         jmethodID handle_funding_locked_meth;
1007         jmethodID handle_shutdown_meth;
1008         jmethodID handle_closing_signed_meth;
1009         jmethodID handle_update_add_htlc_meth;
1010         jmethodID handle_update_fulfill_htlc_meth;
1011         jmethodID handle_update_fail_htlc_meth;
1012         jmethodID handle_update_fail_malformed_htlc_meth;
1013         jmethodID handle_commitment_signed_meth;
1014         jmethodID handle_revoke_and_ack_meth;
1015         jmethodID handle_update_fee_meth;
1016         jmethodID handle_announcement_signatures_meth;
1017         jmethodID peer_disconnected_meth;
1018         jmethodID peer_connected_meth;
1019         jmethodID handle_channel_reestablish_meth;
1020         jmethodID handle_error_meth;
1021 } LDKChannelMessageHandler_JCalls;
1022 void handle_open_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKOpenChannel *msg) {
1023         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1024         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_open_channel_meth, their_node_id, their_features, msg);
1025 }
1026 void handle_accept_channel_jcall(const void* this_arg, LDKPublicKey their_node_id, LDKInitFeatures their_features, const LDKAcceptChannel *msg) {
1027         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1028         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_accept_channel_meth, their_node_id, their_features, msg);
1029 }
1030 void handle_funding_created_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingCreated *msg) {
1031         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1032         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_created_meth, their_node_id, msg);
1033 }
1034 void handle_funding_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingSigned *msg) {
1035         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1036         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_signed_meth, their_node_id, msg);
1037 }
1038 void handle_funding_locked_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKFundingLocked *msg) {
1039         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1040         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_funding_locked_meth, their_node_id, msg);
1041 }
1042 void handle_shutdown_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKShutdown *msg) {
1043         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1044         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_shutdown_meth, their_node_id, msg);
1045 }
1046 void handle_closing_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKClosingSigned *msg) {
1047         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1048         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_closing_signed_meth, their_node_id, msg);
1049 }
1050 void handle_update_add_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateAddHTLC *msg) {
1051         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1052         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_add_htlc_meth, their_node_id, msg);
1053 }
1054 void handle_update_fulfill_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFulfillHTLC *msg) {
1055         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1056         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fulfill_htlc_meth, their_node_id, msg);
1057 }
1058 void handle_update_fail_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailHTLC *msg) {
1059         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1060         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fail_htlc_meth, their_node_id, msg);
1061 }
1062 void handle_update_fail_malformed_htlc_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFailMalformedHTLC *msg) {
1063         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1064         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fail_malformed_htlc_meth, their_node_id, msg);
1065 }
1066 void handle_commitment_signed_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKCommitmentSigned *msg) {
1067         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1068         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_commitment_signed_meth, their_node_id, msg);
1069 }
1070 void handle_revoke_and_ack_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKRevokeAndACK *msg) {
1071         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1072         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_revoke_and_ack_meth, their_node_id, msg);
1073 }
1074 void handle_update_fee_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKUpdateFee *msg) {
1075         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1076         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_update_fee_meth, their_node_id, msg);
1077 }
1078 void handle_announcement_signatures_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKAnnouncementSignatures *msg) {
1079         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1080         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_announcement_signatures_meth, their_node_id, msg);
1081 }
1082 void peer_disconnected_jcall(const void* this_arg, LDKPublicKey their_node_id, bool no_connection_possible) {
1083         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1084         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->peer_disconnected_meth, their_node_id, no_connection_possible);
1085 }
1086 void peer_connected_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKInit *msg) {
1087         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1088         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->peer_connected_meth, their_node_id, msg);
1089 }
1090 void handle_channel_reestablish_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKChannelReestablish *msg) {
1091         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1092         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_channel_reestablish_meth, their_node_id, msg);
1093 }
1094 void handle_error_jcall(const void* this_arg, LDKPublicKey their_node_id, const LDKErrorMessage *msg) {
1095         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1096         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_error_meth, their_node_id, msg);
1097 }
1098 static void LDKChannelMessageHandler_JCalls_free(void* this_arg) {
1099         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1100         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1101                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
1102                 FREE(j_calls);
1103         }
1104 }
1105 static void* LDKChannelMessageHandler_JCalls_clone(const void* this_arg) {
1106         LDKChannelMessageHandler_JCalls *j_calls = (LDKChannelMessageHandler_JCalls*) this_arg;
1107         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1108         atomic_fetch_add_explicit(&j_calls->MessageSendEventsProvider->refcnt, 1, memory_order_release);
1109         return (void*) this_arg;
1110 }
1111 static inline LDKChannelMessageHandler LDKChannelMessageHandler_init (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
1112         jclass c = (*env)->GetObjectClass(env, o);
1113         assert(c != NULL);
1114         LDKChannelMessageHandler_JCalls *calls = MALLOC(sizeof(LDKChannelMessageHandler_JCalls), "LDKChannelMessageHandler_JCalls");
1115         atomic_init(&calls->refcnt, 1);
1116         calls->env = env;
1117         calls->o = (*env)->NewGlobalRef(env, o);
1118         calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "(JJJ)V");
1119         assert(calls->handle_open_channel_meth != NULL);
1120         calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "(JJJ)V");
1121         assert(calls->handle_accept_channel_meth != NULL);
1122         calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "(JJ)V");
1123         assert(calls->handle_funding_created_meth != NULL);
1124         calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "(JJ)V");
1125         assert(calls->handle_funding_signed_meth != NULL);
1126         calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "(JJ)V");
1127         assert(calls->handle_funding_locked_meth != NULL);
1128         calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "(JJ)V");
1129         assert(calls->handle_shutdown_meth != NULL);
1130         calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "(JJ)V");
1131         assert(calls->handle_closing_signed_meth != NULL);
1132         calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "(JJ)V");
1133         assert(calls->handle_update_add_htlc_meth != NULL);
1134         calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "(JJ)V");
1135         assert(calls->handle_update_fulfill_htlc_meth != NULL);
1136         calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "(JJ)V");
1137         assert(calls->handle_update_fail_htlc_meth != NULL);
1138         calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "(JJ)V");
1139         assert(calls->handle_update_fail_malformed_htlc_meth != NULL);
1140         calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "(JJ)V");
1141         assert(calls->handle_commitment_signed_meth != NULL);
1142         calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "(JJ)V");
1143         assert(calls->handle_revoke_and_ack_meth != NULL);
1144         calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "(JJ)V");
1145         assert(calls->handle_update_fee_meth != NULL);
1146         calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "(JJ)V");
1147         assert(calls->handle_announcement_signatures_meth != NULL);
1148         calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "(JZ)V");
1149         assert(calls->peer_disconnected_meth != NULL);
1150         calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "(JJ)V");
1151         assert(calls->peer_connected_meth != NULL);
1152         calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "(JJ)V");
1153         assert(calls->handle_channel_reestablish_meth != NULL);
1154         calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "(JJ)V");
1155         assert(calls->handle_error_meth != NULL);
1156
1157         LDKChannelMessageHandler ret = {
1158                 .this_arg = (void*) calls,
1159                 .handle_open_channel = handle_open_channel_jcall,
1160                 .handle_accept_channel = handle_accept_channel_jcall,
1161                 .handle_funding_created = handle_funding_created_jcall,
1162                 .handle_funding_signed = handle_funding_signed_jcall,
1163                 .handle_funding_locked = handle_funding_locked_jcall,
1164                 .handle_shutdown = handle_shutdown_jcall,
1165                 .handle_closing_signed = handle_closing_signed_jcall,
1166                 .handle_update_add_htlc = handle_update_add_htlc_jcall,
1167                 .handle_update_fulfill_htlc = handle_update_fulfill_htlc_jcall,
1168                 .handle_update_fail_htlc = handle_update_fail_htlc_jcall,
1169                 .handle_update_fail_malformed_htlc = handle_update_fail_malformed_htlc_jcall,
1170                 .handle_commitment_signed = handle_commitment_signed_jcall,
1171                 .handle_revoke_and_ack = handle_revoke_and_ack_jcall,
1172                 .handle_update_fee = handle_update_fee_jcall,
1173                 .handle_announcement_signatures = handle_announcement_signatures_jcall,
1174                 .peer_disconnected = peer_disconnected_jcall,
1175                 .peer_connected = peer_connected_jcall,
1176                 .handle_channel_reestablish = handle_channel_reestablish_jcall,
1177                 .handle_error = handle_error_jcall,
1178                 .free = LDKChannelMessageHandler_JCalls_free,
1179                 .MessageSendEventsProvider = LDKMessageSendEventsProvider_init(env, _a, MessageSendEventsProvider),
1180         };
1181         calls->MessageSendEventsProvider = ret.MessageSendEventsProvider.this_arg;
1182         return ret;
1183 }
1184 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new (JNIEnv * env, jclass _a, jobject o, jobject MessageSendEventsProvider) {
1185         LDKChannelMessageHandler *res_ptr = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
1186         *res_ptr = LDKChannelMessageHandler_init(env, _a, o, MessageSendEventsProvider);
1187         return (long)res_ptr;
1188 }
1189 typedef struct LDKRoutingMessageHandler_JCalls {
1190         atomic_size_t refcnt;
1191         JNIEnv *env;
1192         jobject o;
1193         jmethodID handle_node_announcement_meth;
1194         jmethodID handle_channel_announcement_meth;
1195         jmethodID handle_channel_update_meth;
1196         jmethodID handle_htlc_fail_channel_update_meth;
1197         jmethodID get_next_channel_announcements_meth;
1198         jmethodID get_next_node_announcements_meth;
1199         jmethodID should_request_full_sync_meth;
1200 } LDKRoutingMessageHandler_JCalls;
1201 LDKCResult_boolLightningErrorZ handle_node_announcement_jcall(const void* this_arg, const LDKNodeAnnouncement *msg) {
1202         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1203         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_node_announcement_meth, msg);
1204         LDKCResult_boolLightningErrorZ res = *ret;
1205         FREE(ret);
1206         return res;
1207 }
1208 LDKCResult_boolLightningErrorZ handle_channel_announcement_jcall(const void* this_arg, const LDKChannelAnnouncement *msg) {
1209         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1210         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_channel_announcement_meth, msg);
1211         LDKCResult_boolLightningErrorZ res = *ret;
1212         FREE(ret);
1213         return res;
1214 }
1215 LDKCResult_boolLightningErrorZ handle_channel_update_jcall(const void* this_arg, const LDKChannelUpdate *msg) {
1216         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1217         LDKCResult_boolLightningErrorZ* ret = (LDKCResult_boolLightningErrorZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->handle_channel_update_meth, msg);
1218         LDKCResult_boolLightningErrorZ res = *ret;
1219         FREE(ret);
1220         return res;
1221 }
1222 void handle_htlc_fail_channel_update_jcall(const void* this_arg, const LDKHTLCFailChannelUpdate *update) {
1223         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1224         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->handle_htlc_fail_channel_update_meth, update);
1225 }
1226 LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ get_next_channel_announcements_jcall(const void* this_arg, uint64_t starting_point, uint8_t batch_amount) {
1227         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1228         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ* ret = (LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_next_channel_announcements_meth, starting_point, batch_amount);
1229         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ res = *ret;
1230         FREE(ret);
1231         return res;
1232 }
1233 LDKCVec_NodeAnnouncementZ get_next_node_announcements_jcall(const void* this_arg, LDKPublicKey starting_point, uint8_t batch_amount) {
1234         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1235         LDKCVec_NodeAnnouncementZ* ret = (LDKCVec_NodeAnnouncementZ*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->get_next_node_announcements_meth, starting_point, batch_amount);
1236         LDKCVec_NodeAnnouncementZ res = *ret;
1237         FREE(ret);
1238         return res;
1239 }
1240 bool should_request_full_sync_jcall(const void* this_arg, LDKPublicKey node_id) {
1241         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1242         return (*j_calls->env)->CallBooleanMethod(j_calls->env, j_calls->o, j_calls->should_request_full_sync_meth, node_id);
1243 }
1244 static void LDKRoutingMessageHandler_JCalls_free(void* this_arg) {
1245         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1246         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1247                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
1248                 FREE(j_calls);
1249         }
1250 }
1251 static void* LDKRoutingMessageHandler_JCalls_clone(const void* this_arg) {
1252         LDKRoutingMessageHandler_JCalls *j_calls = (LDKRoutingMessageHandler_JCalls*) this_arg;
1253         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1254         return (void*) this_arg;
1255 }
1256 static inline LDKRoutingMessageHandler LDKRoutingMessageHandler_init (JNIEnv * env, jclass _a, jobject o) {
1257         jclass c = (*env)->GetObjectClass(env, o);
1258         assert(c != NULL);
1259         LDKRoutingMessageHandler_JCalls *calls = MALLOC(sizeof(LDKRoutingMessageHandler_JCalls), "LDKRoutingMessageHandler_JCalls");
1260         atomic_init(&calls->refcnt, 1);
1261         calls->env = env;
1262         calls->o = (*env)->NewGlobalRef(env, o);
1263         calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
1264         assert(calls->handle_node_announcement_meth != NULL);
1265         calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
1266         assert(calls->handle_channel_announcement_meth != NULL);
1267         calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
1268         assert(calls->handle_channel_update_meth != NULL);
1269         calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
1270         assert(calls->handle_htlc_fail_channel_update_meth != NULL);
1271         calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
1272         assert(calls->get_next_channel_announcements_meth != NULL);
1273         calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "(JB)J");
1274         assert(calls->get_next_node_announcements_meth != NULL);
1275         calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "(J)Z");
1276         assert(calls->should_request_full_sync_meth != NULL);
1277
1278         LDKRoutingMessageHandler ret = {
1279                 .this_arg = (void*) calls,
1280                 .handle_node_announcement = handle_node_announcement_jcall,
1281                 .handle_channel_announcement = handle_channel_announcement_jcall,
1282                 .handle_channel_update = handle_channel_update_jcall,
1283                 .handle_htlc_fail_channel_update = handle_htlc_fail_channel_update_jcall,
1284                 .get_next_channel_announcements = get_next_channel_announcements_jcall,
1285                 .get_next_node_announcements = get_next_node_announcements_jcall,
1286                 .should_request_full_sync = should_request_full_sync_jcall,
1287                 .free = LDKRoutingMessageHandler_JCalls_free,
1288         };
1289         return ret;
1290 }
1291 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new (JNIEnv * env, jclass _a, jobject o) {
1292         LDKRoutingMessageHandler *res_ptr = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
1293         *res_ptr = LDKRoutingMessageHandler_init(env, _a, o);
1294         return (long)res_ptr;
1295 }
1296 typedef struct LDKSocketDescriptor_JCalls {
1297         atomic_size_t refcnt;
1298         JNIEnv *env;
1299         jobject o;
1300         jmethodID send_data_meth;
1301         jmethodID disconnect_socket_meth;
1302         jmethodID eq_meth;
1303         jmethodID hash_meth;
1304 } LDKSocketDescriptor_JCalls;
1305 uintptr_t send_data_jcall(void* this_arg, LDKu8slice data, bool resume_read) {
1306         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1307         uintptr_t* ret = (uintptr_t*)(*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->send_data_meth, data, resume_read);
1308         uintptr_t res = *ret;
1309         FREE(ret);
1310         return res;
1311 }
1312 void disconnect_socket_jcall(void* this_arg) {
1313         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1314         return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->disconnect_socket_meth);
1315 }
1316 bool eq_jcall(const void* this_arg, const void *other_arg) {
1317         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1318         return (*j_calls->env)->CallBooleanMethod(j_calls->env, j_calls->o, j_calls->eq_meth, other_arg);
1319 }
1320 uint64_t hash_jcall(const void* this_arg) {
1321         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1322         return (*j_calls->env)->CallLongMethod(j_calls->env, j_calls->o, j_calls->hash_meth);
1323 }
1324 static void LDKSocketDescriptor_JCalls_free(void* this_arg) {
1325         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1326         if (atomic_fetch_sub_explicit(&j_calls->refcnt, 1, memory_order_acquire) == 1) {
1327                 (*j_calls->env)->DeleteGlobalRef(j_calls->env, j_calls->o);
1328                 FREE(j_calls);
1329         }
1330 }
1331 static void* LDKSocketDescriptor_JCalls_clone(const void* this_arg) {
1332         LDKSocketDescriptor_JCalls *j_calls = (LDKSocketDescriptor_JCalls*) this_arg;
1333         atomic_fetch_add_explicit(&j_calls->refcnt, 1, memory_order_release);
1334         return (void*) this_arg;
1335 }
1336 static inline LDKSocketDescriptor LDKSocketDescriptor_init (JNIEnv * env, jclass _a, jobject o) {
1337         jclass c = (*env)->GetObjectClass(env, o);
1338         assert(c != NULL);
1339         LDKSocketDescriptor_JCalls *calls = MALLOC(sizeof(LDKSocketDescriptor_JCalls), "LDKSocketDescriptor_JCalls");
1340         atomic_init(&calls->refcnt, 1);
1341         calls->env = env;
1342         calls->o = (*env)->NewGlobalRef(env, o);
1343         calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
1344         assert(calls->send_data_meth != NULL);
1345         calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
1346         assert(calls->disconnect_socket_meth != NULL);
1347         calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(V)Z");
1348         assert(calls->eq_meth != NULL);
1349         calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
1350         assert(calls->hash_meth != NULL);
1351
1352         LDKSocketDescriptor ret = {
1353                 .this_arg = (void*) calls,
1354                 .send_data = send_data_jcall,
1355                 .disconnect_socket = disconnect_socket_jcall,
1356                 .eq = eq_jcall,
1357                 .hash = hash_jcall,
1358                 .clone = LDKSocketDescriptor_JCalls_clone,
1359                 .free = LDKSocketDescriptor_JCalls_free,
1360         };
1361         return ret;
1362 }
1363 JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIEnv * env, jclass _a, jobject o) {
1364         LDKSocketDescriptor *res_ptr = MALLOC(sizeof(LDKSocketDescriptor), "LDKSocketDescriptor");
1365         *res_ptr = LDKSocketDescriptor_init(env, _a, o);
1366         return (long)res_ptr;
1367 }
1368 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1369         LDKC2Tuple_HTLCOutputInCommitmentSignatureZ arg_conv = *(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ*)arg;
1370         FREE((void*)arg);
1371         return C2Tuple_HTLCOutputInCommitmentSignatureZ_free(arg_conv);
1372 }
1373
1374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1375         LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
1376         FREE((void*)arg);
1377         return C2Tuple_OutPointScriptZ_free(arg_conv);
1378 }
1379
1380 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Scriptu64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
1381         LDKC2Tuple_Scriptu64Z arg_conv = *(LDKC2Tuple_Scriptu64Z*)arg;
1382         FREE((void*)arg);
1383         return C2Tuple_Scriptu64Z_free(arg_conv);
1384 }
1385
1386 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1387         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
1388         FREE((void*)arg);
1389         return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
1390 }
1391
1392 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Txidu32Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
1393         LDKC2Tuple_Txidu32Z arg_conv = *(LDKC2Tuple_Txidu32Z*)arg;
1394         FREE((void*)arg);
1395         return C2Tuple_Txidu32Z_free(arg_conv);
1396 }
1397
1398 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
1399         LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
1400         FREE((void*)arg);
1401         return C2Tuple_u64u64Z_free(arg_conv);
1402 }
1403
1404 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1405         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
1406         FREE((void*)arg);
1407         return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
1408 }
1409
1410 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1Scriptu64ZChainErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
1411         LDKChainError arg_conv = *(LDKChainError*)arg;
1412         FREE((void*)arg);
1413         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ), "LDKCResult_C2Tuple_Scriptu64ZChainErrorZ");
1414         *ret = CResult_C2Tuple_Scriptu64ZChainErrorZ_err(arg_conv);
1415         return (long)ret;
1416 }
1417
1418 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1Scriptu64ZChainErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1419         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ arg_conv = *(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ*)arg;
1420         FREE((void*)arg);
1421         return CResult_C2Tuple_Scriptu64ZChainErrorZ_free(arg_conv);
1422 }
1423
1424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1Scriptu64ZChainErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1425         LDKC2Tuple_Scriptu64Z arg_conv = *(LDKC2Tuple_Scriptu64Z*)arg;
1426         FREE((void*)arg);
1427         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ), "LDKCResult_C2Tuple_Scriptu64ZChainErrorZ");
1428         *ret = CResult_C2Tuple_Scriptu64ZChainErrorZ_ok(arg_conv);
1429         return (long)ret;
1430 }
1431
1432 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1433         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
1434         FREE((void*)arg);
1435         return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
1436 }
1437
1438 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1439         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
1440         FREE((void*)arg);
1441         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1442         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_ok(arg_conv);
1443         return (long)ret;
1444 }
1445
1446 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1447         LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
1448         FREE((void*)arg);
1449         return CResult_CVec_SignatureZNoneZ_free(arg_conv);
1450 }
1451
1452 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1453         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
1454         FREE((void*)arg);
1455         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1456         *ret = CResult_CVec_SignatureZNoneZ_ok(arg_conv);
1457         return (long)ret;
1458 }
1459
1460 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1461         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
1462         FREE((void*)arg);
1463         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
1464         *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
1465         return (long)ret;
1466 }
1467
1468 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1469         LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
1470         FREE((void*)arg);
1471         return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
1472 }
1473
1474 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1u8ZPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1475         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
1476         FREE((void*)arg);
1477         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
1478         *ret = CResult_CVec_u8ZPeerHandleErrorZ_ok(arg_conv);
1479         return (long)ret;
1480 }
1481
1482 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1483         LDKAPIError arg_conv = *(LDKAPIError*)arg;
1484         FREE((void*)arg);
1485         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
1486         *ret = CResult_NoneAPIErrorZ_err(arg_conv);
1487         return (long)ret;
1488 }
1489
1490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1491         LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
1492         FREE((void*)arg);
1493         return CResult_NoneAPIErrorZ_free(arg_conv);
1494 }
1495
1496 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
1497         LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
1498         FREE((void*)arg);
1499         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1500         *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
1501         return (long)ret;
1502 }
1503
1504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1505         LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
1506         FREE((void*)arg);
1507         return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
1508 }
1509
1510 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1511         LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
1512         FREE((void*)arg);
1513         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
1514         *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
1515         return (long)ret;
1516 }
1517
1518 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1519         LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
1520         FREE((void*)arg);
1521         return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
1522 }
1523
1524 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1525         LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
1526         FREE((void*)arg);
1527         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
1528         *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
1529         return (long)ret;
1530 }
1531
1532 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1533         LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
1534         FREE((void*)arg);
1535         return CResult_NonePaymentSendFailureZ_free(arg_conv);
1536 }
1537
1538 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1539         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
1540         FREE((void*)arg);
1541         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
1542         *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
1543         return (long)ret;
1544 }
1545
1546 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1547         LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
1548         FREE((void*)arg);
1549         return CResult_NonePeerHandleErrorZ_free(arg_conv);
1550 }
1551
1552 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1553         LDKLightningError arg_conv = *(LDKLightningError*)arg;
1554         FREE((void*)arg);
1555         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
1556         *ret = CResult_RouteLightningErrorZ_err(arg_conv);
1557         return (long)ret;
1558 }
1559
1560 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1561         LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
1562         FREE((void*)arg);
1563         return CResult_RouteLightningErrorZ_free(arg_conv);
1564 }
1565
1566 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1RouteLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1567         LDKRoute arg_conv = *(LDKRoute*)arg;
1568         FREE((void*)arg);
1569         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
1570         *ret = CResult_RouteLightningErrorZ_ok(arg_conv);
1571         return (long)ret;
1572 }
1573
1574 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1575         LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
1576         FREE((void*)arg);
1577         return CResult_SignatureNoneZ_free(arg_conv);
1578 }
1579
1580 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1581         LDKSignature arg_conv = *(LDKSignature*)arg;
1582         FREE((void*)arg);
1583         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1584         *ret = CResult_SignatureNoneZ_ok(arg_conv);
1585         return (long)ret;
1586 }
1587
1588 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1err(JNIEnv * _env, jclass _b, jclass arg) {
1589         LDKSecp256k1Error arg_conv = *(LDKSecp256k1Error*)arg;
1590         FREE((void*)arg);
1591         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
1592         *ret = CResult_TxCreationKeysSecpErrorZ_err(arg_conv);
1593         return (long)ret;
1594 }
1595
1596 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1597         LDKCResult_TxCreationKeysSecpErrorZ arg_conv = *(LDKCResult_TxCreationKeysSecpErrorZ*)arg;
1598         FREE((void*)arg);
1599         return CResult_TxCreationKeysSecpErrorZ_free(arg_conv);
1600 }
1601
1602 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1TxCreationKeysSecpErrorZ_1ok(JNIEnv * _env, jclass _b, jlong arg) {
1603         LDKTxCreationKeys arg_conv = *(LDKTxCreationKeys*)arg;
1604         FREE((void*)arg);
1605         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
1606         *ret = CResult_TxCreationKeysSecpErrorZ_ok(arg_conv);
1607         return (long)ret;
1608 }
1609
1610 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1611         LDKLightningError arg_conv = *(LDKLightningError*)arg;
1612         FREE((void*)arg);
1613         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
1614         *ret = CResult_boolLightningErrorZ_err(arg_conv);
1615         return (long)ret;
1616 }
1617
1618 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1619         LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
1620         FREE((void*)arg);
1621         return CResult_boolLightningErrorZ_free(arg_conv);
1622 }
1623
1624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolLightningErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
1625         LDKCResult_boolLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_boolLightningErrorZ), "LDKCResult_boolLightningErrorZ");
1626         *ret = CResult_boolLightningErrorZ_ok(arg);
1627         return (long)ret;
1628 }
1629
1630 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1err(JNIEnv * _env, jclass _b, jlong arg) {
1631         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
1632         FREE((void*)arg);
1633         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
1634         *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
1635         return (long)ret;
1636 }
1637
1638 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1639         LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
1640         FREE((void*)arg);
1641         return CResult_boolPeerHandleErrorZ_free(arg_conv);
1642 }
1643
1644 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1boolPeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b, jboolean arg) {
1645         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
1646         *ret = CResult_boolPeerHandleErrorZ_ok(arg);
1647         return (long)ret;
1648 }
1649
1650 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C2Tuple_1HTLCOutputInCommitmentSignatureZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1651         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ arg_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)arg;
1652         FREE((void*)arg);
1653         return CVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ_free(arg_conv);
1654 }
1655
1656 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1657         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
1658         FREE((void*)arg);
1659         return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
1660 }
1661
1662 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1CVec_1RouteHopZZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1663         LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
1664         FREE((void*)arg);
1665         return CVec_CVec_RouteHopZZ_free(arg_conv);
1666 }
1667
1668 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelDetailsZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1669         LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
1670         FREE((void*)arg);
1671         return CVec_ChannelDetailsZ_free(arg_conv);
1672 }
1673
1674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1ChannelMonitorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1675         LDKCVec_ChannelMonitorZ arg_conv = *(LDKCVec_ChannelMonitorZ*)arg;
1676         FREE((void*)arg);
1677         return CVec_ChannelMonitorZ_free(arg_conv);
1678 }
1679
1680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1EventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1681         LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
1682         FREE((void*)arg);
1683         return CVec_EventZ_free(arg_conv);
1684 }
1685
1686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1HTLCOutputInCommitmentZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1687         LDKCVec_HTLCOutputInCommitmentZ arg_conv = *(LDKCVec_HTLCOutputInCommitmentZ*)arg;
1688         FREE((void*)arg);
1689         return CVec_HTLCOutputInCommitmentZ_free(arg_conv);
1690 }
1691
1692 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MessageSendEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1693         LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
1694         FREE((void*)arg);
1695         return CVec_MessageSendEventZ_free(arg_conv);
1696 }
1697
1698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1MonitorEventZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1699         LDKCVec_MonitorEventZ arg_conv = *(LDKCVec_MonitorEventZ*)arg;
1700         FREE((void*)arg);
1701         return CVec_MonitorEventZ_free(arg_conv);
1702 }
1703
1704 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NetAddressZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1705         LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
1706         FREE((void*)arg);
1707         return CVec_NetAddressZ_free(arg_conv);
1708 }
1709
1710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1NodeAnnouncementZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1711         LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
1712         FREE((void*)arg);
1713         return CVec_NodeAnnouncementZ_free(arg_conv);
1714 }
1715
1716 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1PublicKeyZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1717         LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
1718         FREE((void*)arg);
1719         return CVec_PublicKeyZ_free(arg_conv);
1720 }
1721
1722 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHintZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1723         LDKCVec_RouteHintZ arg_conv = *(LDKCVec_RouteHintZ*)arg;
1724         FREE((void*)arg);
1725         return CVec_RouteHintZ_free(arg_conv);
1726 }
1727
1728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1RouteHopZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1729         LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
1730         FREE((void*)arg);
1731         return CVec_RouteHopZ_free(arg_conv);
1732 }
1733
1734 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SignatureZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1735         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
1736         FREE((void*)arg);
1737         return CVec_SignatureZ_free(arg_conv);
1738 }
1739
1740 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1SpendableOutputDescriptorZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1741         LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
1742         FREE((void*)arg);
1743         return CVec_SpendableOutputDescriptorZ_free(arg_conv);
1744 }
1745
1746 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1TransactionZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1747         LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
1748         FREE((void*)arg);
1749         return CVec_TransactionZ_free(arg_conv);
1750 }
1751
1752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateAddHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1753         LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
1754         FREE((void*)arg);
1755         return CVec_UpdateAddHTLCZ_free(arg_conv);
1756 }
1757
1758 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1759         LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
1760         FREE((void*)arg);
1761         return CVec_UpdateFailHTLCZ_free(arg_conv);
1762 }
1763
1764 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFailMalformedHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1765         LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
1766         FREE((void*)arg);
1767         return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
1768 }
1769
1770 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1UpdateFulfillHTLCZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1771         LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
1772         FREE((void*)arg);
1773         return CVec_UpdateFulfillHTLCZ_free(arg_conv);
1774 }
1775
1776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u64Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
1777         LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
1778         FREE((void*)arg);
1779         return CVec_u64Z_free(arg_conv);
1780 }
1781
1782 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1u8Z_1free(JNIEnv * _env, jclass _b, jlong arg) {
1783         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
1784         FREE((void*)arg);
1785         return CVec_u8Z_free(arg_conv);
1786 }
1787
1788 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CVec_1usizeZ_1free(JNIEnv * _env, jclass _b, jlong arg) {
1789         LDKCVec_usizeZ arg_conv = *(LDKCVec_usizeZ*)arg;
1790         FREE((void*)arg);
1791         return CVec_usizeZ_free(arg_conv);
1792 }
1793
1794 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxOut_1free(JNIEnv * _env, jclass _b, jlong _res) {
1795         LDKTxOut _res_conv = *(LDKTxOut*)_res;
1796         FREE((void*)_res);
1797         return TxOut_free(_res_conv);
1798 }
1799
1800 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Txidu32Z_1new(JNIEnv * _env, jclass _b, jlong a, jint b) {
1801         LDKThirtyTwoBytes a_conv = *(LDKThirtyTwoBytes*)a;
1802         FREE((void*)a);
1803         LDKC2Tuple_Txidu32Z* ret = MALLOC(sizeof(LDKC2Tuple_Txidu32Z), "LDKC2Tuple_Txidu32Z");
1804         *ret = C2Tuple_Txidu32Z_new(a_conv, b);
1805         return (long)ret;
1806 }
1807
1808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1Scriptu64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
1809         LDKCVec_u8Z a_conv = *(LDKCVec_u8Z*)a;
1810         FREE((void*)a);
1811         LDKC2Tuple_Scriptu64Z* ret = MALLOC(sizeof(LDKC2Tuple_Scriptu64Z), "LDKC2Tuple_Scriptu64Z");
1812         *ret = C2Tuple_Scriptu64Z_new(a_conv, b);
1813         return (long)ret;
1814 }
1815
1816 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1u64u64Z_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
1817         LDKC2Tuple_u64u64Z* ret = MALLOC(sizeof(LDKC2Tuple_u64u64Z), "LDKC2Tuple_u64u64Z");
1818         *ret = C2Tuple_u64u64Z_new(a, b);
1819         return (long)ret;
1820 }
1821
1822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1SignatureCVec_1SignatureZZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
1823         LDKSignature a_conv = *(LDKSignature*)a;
1824         FREE((void*)a);
1825         LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
1826         FREE((void*)b);
1827         LDKC2Tuple_SignatureCVec_SignatureZZ* ret = MALLOC(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ), "LDKC2Tuple_SignatureCVec_SignatureZZ");
1828         *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
1829         return (long)ret;
1830 }
1831
1832 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1C2Tuple_1SignatureCVec_1SignatureZZNoneZ_1err(JNIEnv * _env, jclass _b) {
1833         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = MALLOC(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ), "LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ");
1834         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
1835         return (long)ret;
1836 }
1837
1838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1SignatureNoneZ_1err(JNIEnv * _env, jclass _b) {
1839         LDKCResult_SignatureNoneZ* ret = MALLOC(sizeof(LDKCResult_SignatureNoneZ), "LDKCResult_SignatureNoneZ");
1840         *ret = CResult_SignatureNoneZ_err();
1841         return (long)ret;
1842 }
1843
1844 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1CVec_1SignatureZNoneZ_1err(JNIEnv * _env, jclass _b) {
1845         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
1846         *ret = CResult_CVec_SignatureZNoneZ_err();
1847         return (long)ret;
1848 }
1849
1850 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneAPIErrorZ_1ok(JNIEnv * _env, jclass _b) {
1851         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
1852         *ret = CResult_NoneAPIErrorZ_ok();
1853         return (long)ret;
1854 }
1855
1856 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePaymentSendFailureZ_1ok(JNIEnv * _env, jclass _b) {
1857         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
1858         *ret = CResult_NonePaymentSendFailureZ_ok();
1859         return (long)ret;
1860 }
1861
1862 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneChannelMonitorUpdateErrZ_1ok(JNIEnv * _env, jclass _b) {
1863         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = MALLOC(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ), "LDKCResult_NoneChannelMonitorUpdateErrZ");
1864         *ret = CResult_NoneChannelMonitorUpdateErrZ_ok();
1865         return (long)ret;
1866 }
1867
1868 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NoneMonitorUpdateErrorZ_1ok(JNIEnv * _env, jclass _b) {
1869         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
1870         *ret = CResult_NoneMonitorUpdateErrorZ_ok();
1871         return (long)ret;
1872 }
1873
1874 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1OutPointScriptZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
1875         LDKOutPoint a_conv = *(LDKOutPoint*)a;
1876         FREE((void*)a);
1877         a_conv._underlying_ref = false;
1878         LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
1879         FREE((void*)b);
1880         LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
1881         *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
1882         return (long)ret;
1883 }
1884
1885 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C3Tuple_1ChannelAnnouncementChannelUpdateChannelUpdateZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
1886         LDKChannelAnnouncement a_conv = *(LDKChannelAnnouncement*)a;
1887         FREE((void*)a);
1888         a_conv._underlying_ref = false;
1889         LDKChannelUpdate b_conv = *(LDKChannelUpdate*)b;
1890         FREE((void*)b);
1891         b_conv._underlying_ref = false;
1892         LDKChannelUpdate c_conv = *(LDKChannelUpdate*)c;
1893         FREE((void*)c);
1894         c_conv._underlying_ref = false;
1895         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = MALLOC(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ), "LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ");
1896         *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
1897         return (long)ret;
1898 }
1899
1900 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CResult_1NonePeerHandleErrorZ_1ok(JNIEnv * _env, jclass _b) {
1901         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
1902         *ret = CResult_NonePeerHandleErrorZ_ok();
1903         return (long)ret;
1904 }
1905
1906 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_C2Tuple_1HTLCOutputInCommitmentSignatureZ_1new(JNIEnv * _env, jclass _b, jlong a, jlong b) {
1907         LDKHTLCOutputInCommitment a_conv = *(LDKHTLCOutputInCommitment*)a;
1908         FREE((void*)a);
1909         a_conv._underlying_ref = false;
1910         LDKSignature b_conv = *(LDKSignature*)b;
1911         FREE((void*)b);
1912         LDKC2Tuple_HTLCOutputInCommitmentSignatureZ* ret = MALLOC(sizeof(LDKC2Tuple_HTLCOutputInCommitmentSignatureZ), "LDKC2Tuple_HTLCOutputInCommitmentSignatureZ");
1913         *ret = C2Tuple_HTLCOutputInCommitmentSignatureZ_new(a_conv, b_conv);
1914         return (long)ret;
1915 }
1916
1917 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Event_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1918         LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
1919         FREE((void*)this_ptr);
1920         return Event_free(this_ptr_conv);
1921 }
1922
1923 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1924         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
1925         FREE((void*)this_ptr);
1926         return MessageSendEvent_free(this_ptr_conv);
1927 }
1928
1929 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageSendEventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1930         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
1931         FREE((void*)this_ptr);
1932         return MessageSendEventsProvider_free(this_ptr_conv);
1933 }
1934
1935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_EventsProvider_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1936         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
1937         FREE((void*)this_ptr);
1938         return EventsProvider_free(this_ptr_conv);
1939 }
1940
1941 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_APIError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1942         LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
1943         FREE((void*)this_ptr);
1944         return APIError_free(this_ptr_conv);
1945 }
1946
1947 JNIEXPORT jclass JNICALL Java_org_ldk_impl_bindings_Level_1max(JNIEnv * _env, jclass _b) {
1948         jclass ret = LDKLevel_to_java(_env, Level_max());
1949         return ret;
1950 }
1951
1952 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Logger_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1953         LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
1954         FREE((void*)this_ptr);
1955         return Logger_free(this_ptr_conv);
1956 }
1957
1958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
1959         LDKChannelHandshakeConfig this_ptr_conv = *(LDKChannelHandshakeConfig*)this_ptr;
1960         FREE((void*)this_ptr);
1961         this_ptr_conv._underlying_ref = false;
1962         return ChannelHandshakeConfig_free(this_ptr_conv);
1963 }
1964
1965 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
1966         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1967         return ChannelHandshakeConfig_get_minimum_depth(this_ptr_conv);
1968 }
1969
1970 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
1971         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1972         return ChannelHandshakeConfig_set_minimum_depth(this_ptr_conv, val);
1973 }
1974
1975 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
1976         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1977         return ChannelHandshakeConfig_get_our_to_self_delay(this_ptr_conv);
1978 }
1979
1980 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
1981         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1982         return ChannelHandshakeConfig_set_our_to_self_delay(this_ptr_conv, val);
1983 }
1984
1985 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
1986         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1987         return ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr_conv);
1988 }
1989
1990 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1991         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
1992         return ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr_conv, val);
1993 }
1994
1995 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) {
1996         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
1997         *ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
1998         assert(!ret->_underlying_ref);
1999         ret->_underlying_ref = true;
2000         return (long)ret;
2001 }
2002
2003 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1default(JNIEnv * _env, jclass _b) {
2004         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
2005         *ret = ChannelHandshakeConfig_default();
2006         assert(!ret->_underlying_ref);
2007         ret->_underlying_ref = true;
2008         return (long)ret;
2009 }
2010
2011 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2012         LDKChannelHandshakeLimits this_ptr_conv = *(LDKChannelHandshakeLimits*)this_ptr;
2013         FREE((void*)this_ptr);
2014         this_ptr_conv._underlying_ref = false;
2015         return ChannelHandshakeLimits_free(this_ptr_conv);
2016 }
2017
2018 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
2019         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2020         return ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr_conv);
2021 }
2022
2023 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2024         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2025         return ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr_conv, val);
2026 }
2027
2028 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2029         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2030         return ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr_conv);
2031 }
2032
2033 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2034         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2035         return ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr_conv, val);
2036 }
2037
2038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2039         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2040         return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr_conv);
2041 }
2042
2043 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) {
2044         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2045         return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this_ptr_conv, val);
2046 }
2047
2048 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
2049         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2050         return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr_conv);
2051 }
2052
2053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2054         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2055         return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr_conv, val);
2056 }
2057
2058 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
2059         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2060         return ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr_conv);
2061 }
2062
2063 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
2064         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2065         return ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr_conv, val);
2066 }
2067
2068 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
2069         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2070         return ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr_conv);
2071 }
2072
2073 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2074         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2075         return ChannelHandshakeLimits_set_min_dust_limit_satoshis(this_ptr_conv, val);
2076 }
2077
2078 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
2079         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2080         return ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr_conv);
2081 }
2082
2083 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2084         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2085         return ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr_conv, val);
2086 }
2087
2088 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
2089         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2090         return ChannelHandshakeLimits_get_max_minimum_depth(this_ptr_conv);
2091 }
2092
2093 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1max_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2094         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2095         return ChannelHandshakeLimits_set_max_minimum_depth(this_ptr_conv, val);
2096 }
2097
2098 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr) {
2099         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2100         return ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr_conv);
2101 }
2102
2103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1force_1announced_1channel_1preference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
2104         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2105         return ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr_conv, val);
2106 }
2107
2108 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
2109         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2110         return ChannelHandshakeLimits_get_their_to_self_delay(this_ptr_conv);
2111 }
2112
2113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
2114         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
2115         return ChannelHandshakeLimits_set_their_to_self_delay(this_ptr_conv, val);
2116 }
2117
2118 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) {
2119         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
2120         *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);
2121         assert(!ret->_underlying_ref);
2122         ret->_underlying_ref = true;
2123         return (long)ret;
2124 }
2125
2126 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1default(JNIEnv * _env, jclass _b) {
2127         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
2128         *ret = ChannelHandshakeLimits_default();
2129         assert(!ret->_underlying_ref);
2130         ret->_underlying_ref = true;
2131         return (long)ret;
2132 }
2133
2134 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2135         LDKChannelConfig this_ptr_conv = *(LDKChannelConfig*)this_ptr;
2136         FREE((void*)this_ptr);
2137         this_ptr_conv._underlying_ref = false;
2138         return ChannelConfig_free(this_ptr_conv);
2139 }
2140
2141 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
2142         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2143         return ChannelConfig_get_fee_proportional_millionths(this_ptr_conv);
2144 }
2145
2146 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2147         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2148         return ChannelConfig_set_fee_proportional_millionths(this_ptr_conv, val);
2149 }
2150
2151 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr) {
2152         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2153         return ChannelConfig_get_announced_channel(this_ptr_conv);
2154 }
2155
2156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1announced_1channel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
2157         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2158         return ChannelConfig_set_announced_channel(this_ptr_conv, val);
2159 }
2160
2161 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1get_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
2162         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2163         return ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr_conv);
2164 }
2165
2166 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1set_1commit_1upfront_1shutdown_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
2167         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
2168         return ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr_conv, val);
2169 }
2170
2171 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) {
2172         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
2173         *ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
2174         assert(!ret->_underlying_ref);
2175         ret->_underlying_ref = true;
2176         return (long)ret;
2177 }
2178
2179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1default(JNIEnv * _env, jclass _b) {
2180         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
2181         *ret = ChannelConfig_default();
2182         assert(!ret->_underlying_ref);
2183         ret->_underlying_ref = true;
2184         return (long)ret;
2185 }
2186
2187 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1write(JNIEnv * _env, jclass _b, jlong obj) {
2188         LDKChannelConfig* obj_conv = (LDKChannelConfig*)obj;
2189         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2190         *ret = ChannelConfig_write(obj_conv);
2191         return (long)ret;
2192 }
2193
2194 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelConfig_1read(JNIEnv * _env, jclass _b, jlong ser) {
2195         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2196         FREE((void*)ser);
2197         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
2198         *ret = ChannelConfig_read(ser_conv);
2199         assert(!ret->_underlying_ref);
2200         ret->_underlying_ref = true;
2201         return (long)ret;
2202 }
2203
2204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2205         LDKUserConfig this_ptr_conv = *(LDKUserConfig*)this_ptr;
2206         FREE((void*)this_ptr);
2207         this_ptr_conv._underlying_ref = false;
2208         return UserConfig_free(this_ptr_conv);
2209 }
2210
2211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
2212         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2213         LDKChannelHandshakeConfig* ret = MALLOC(sizeof(LDKChannelHandshakeConfig), "LDKChannelHandshakeConfig");
2214         *ret = UserConfig_get_own_channel_config(this_ptr_conv);
2215         assert(!ret->_underlying_ref);
2216         ret->_underlying_ref = true;
2217         return (long)ret;
2218 }
2219
2220 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1own_1channel_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2221         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2222         LDKChannelHandshakeConfig val_conv = *(LDKChannelHandshakeConfig*)val;
2223         FREE((void*)val);
2224         val_conv._underlying_ref = false;
2225         return UserConfig_set_own_channel_config(this_ptr_conv, val_conv);
2226 }
2227
2228 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr) {
2229         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2230         LDKChannelHandshakeLimits* ret = MALLOC(sizeof(LDKChannelHandshakeLimits), "LDKChannelHandshakeLimits");
2231         *ret = UserConfig_get_peer_channel_config_limits(this_ptr_conv);
2232         assert(!ret->_underlying_ref);
2233         ret->_underlying_ref = true;
2234         return (long)ret;
2235 }
2236
2237 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1peer_1channel_1config_1limits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2238         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2239         LDKChannelHandshakeLimits val_conv = *(LDKChannelHandshakeLimits*)val;
2240         FREE((void*)val);
2241         val_conv._underlying_ref = false;
2242         return UserConfig_set_peer_channel_config_limits(this_ptr_conv, val_conv);
2243 }
2244
2245 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1get_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr) {
2246         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2247         LDKChannelConfig* ret = MALLOC(sizeof(LDKChannelConfig), "LDKChannelConfig");
2248         *ret = UserConfig_get_channel_options(this_ptr_conv);
2249         assert(!ret->_underlying_ref);
2250         ret->_underlying_ref = true;
2251         return (long)ret;
2252 }
2253
2254 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UserConfig_1set_1channel_1options(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2255         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
2256         LDKChannelConfig val_conv = *(LDKChannelConfig*)val;
2257         FREE((void*)val);
2258         val_conv._underlying_ref = false;
2259         return UserConfig_set_channel_options(this_ptr_conv, val_conv);
2260 }
2261
2262 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) {
2263         LDKChannelHandshakeConfig own_channel_config_arg_conv = *(LDKChannelHandshakeConfig*)own_channel_config_arg;
2264         FREE((void*)own_channel_config_arg);
2265         own_channel_config_arg_conv._underlying_ref = false;
2266         LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv = *(LDKChannelHandshakeLimits*)peer_channel_config_limits_arg;
2267         FREE((void*)peer_channel_config_limits_arg);
2268         peer_channel_config_limits_arg_conv._underlying_ref = false;
2269         LDKChannelConfig channel_options_arg_conv = *(LDKChannelConfig*)channel_options_arg;
2270         FREE((void*)channel_options_arg);
2271         channel_options_arg_conv._underlying_ref = false;
2272         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
2273         *ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
2274         assert(!ret->_underlying_ref);
2275         ret->_underlying_ref = true;
2276         return (long)ret;
2277 }
2278
2279 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UserConfig_1default(JNIEnv * _env, jclass _b) {
2280         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
2281         *ret = UserConfig_default();
2282         assert(!ret->_underlying_ref);
2283         ret->_underlying_ref = true;
2284         return (long)ret;
2285 }
2286
2287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainWatchInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2288         LDKChainWatchInterface this_ptr_conv = *(LDKChainWatchInterface*)this_ptr;
2289         FREE((void*)this_ptr);
2290         return ChainWatchInterface_free(this_ptr_conv);
2291 }
2292
2293 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BroadcasterInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2294         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
2295         FREE((void*)this_ptr);
2296         return BroadcasterInterface_free(this_ptr_conv);
2297 }
2298
2299 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainListener_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2300         LDKChainListener this_ptr_conv = *(LDKChainListener*)this_ptr;
2301         FREE((void*)this_ptr);
2302         return ChainListener_free(this_ptr_conv);
2303 }
2304
2305 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FeeEstimator_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2306         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
2307         FREE((void*)this_ptr);
2308         return FeeEstimator_free(this_ptr_conv);
2309 }
2310
2311 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2312         LDKChainWatchedUtil this_ptr_conv = *(LDKChainWatchedUtil*)this_ptr;
2313         FREE((void*)this_ptr);
2314         this_ptr_conv._underlying_ref = false;
2315         return ChainWatchedUtil_free(this_ptr_conv);
2316 }
2317
2318 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1new(JNIEnv * _env, jclass _b) {
2319         LDKChainWatchedUtil* ret = MALLOC(sizeof(LDKChainWatchedUtil), "LDKChainWatchedUtil");
2320         *ret = ChainWatchedUtil_new();
2321         assert(!ret->_underlying_ref);
2322         ret->_underlying_ref = true;
2323         return (long)ret;
2324 }
2325
2326 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1register_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jlong script_pub_key) {
2327         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
2328         unsigned char txid_arr[32];
2329         (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
2330         unsigned char (*txid_ref)[32] = &txid_arr;
2331         LDKu8slice script_pub_key_conv = *(LDKu8slice*)script_pub_key;
2332         FREE((void*)script_pub_key);
2333         return ChainWatchedUtil_register_tx(this_arg_conv, txid_ref, script_pub_key_conv);
2334 }
2335
2336 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1register_1outpoint(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jlong _script_pub_key) {
2337         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
2338         LDKC2Tuple_Txidu32Z outpoint_conv = *(LDKC2Tuple_Txidu32Z*)outpoint;
2339         FREE((void*)outpoint);
2340         LDKu8slice _script_pub_key_conv = *(LDKu8slice*)_script_pub_key;
2341         FREE((void*)_script_pub_key);
2342         return ChainWatchedUtil_register_outpoint(this_arg_conv, outpoint_conv, _script_pub_key_conv);
2343 }
2344
2345 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1watch_1all(JNIEnv * _env, jclass _b, jlong this_arg) {
2346         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
2347         return ChainWatchedUtil_watch_all(this_arg_conv);
2348 }
2349
2350 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChainWatchedUtil_1does_1match_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2351         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
2352         LDKTransaction tx_conv = *(LDKTransaction*)tx;
2353         FREE((void*)tx);
2354         return ChainWatchedUtil_does_match_tx(this_arg_conv, tx_conv);
2355 }
2356
2357 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2358         LDKBlockNotifier this_ptr_conv = *(LDKBlockNotifier*)this_ptr;
2359         FREE((void*)this_ptr);
2360         this_ptr_conv._underlying_ref = false;
2361         return BlockNotifier_free(this_ptr_conv);
2362 }
2363
2364 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1new(JNIEnv * _env, jclass _b, jlong chain_monitor) {
2365         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
2366         LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
2367         LDKBlockNotifier* ret = MALLOC(sizeof(LDKBlockNotifier), "LDKBlockNotifier");
2368         *ret = BlockNotifier_new(chain_monitor_conv);
2369         assert(!ret->_underlying_ref);
2370         ret->_underlying_ref = true;
2371         return (long)ret;
2372 }
2373
2374 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1register_1listener(JNIEnv * _env, jclass _b, jlong this_arg, jlong listener) {
2375         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
2376         LDKChainListener listener_conv = *(LDKChainListener*)listener;
2377         LDKChainListener_JCalls_clone(listener_conv.this_arg);
2378         return BlockNotifier_register_listener(this_arg_conv, listener_conv);
2379 }
2380
2381 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1block_1connected(JNIEnv * _env, jclass _b, jlong this_arg, jlong block, jint height) {
2382         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
2383         LDKu8slice block_conv = *(LDKu8slice*)block;
2384         FREE((void*)block);
2385         return BlockNotifier_block_connected(this_arg_conv, block_conv, height);
2386 }
2387
2388 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1block_1connected_1checked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint height, jlong txn_matched, jlong indexes_of_txn_matched) {
2389         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
2390         unsigned char header_arr[80];
2391         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
2392         unsigned char (*header_ref)[80] = &header_arr;
2393         LDKCVec_TransactionZ txn_matched_conv = *(LDKCVec_TransactionZ*)txn_matched;
2394         FREE((void*)txn_matched);
2395         LDKusizeslice indexes_of_txn_matched_conv = *(LDKusizeslice*)indexes_of_txn_matched;
2396         FREE((void*)indexes_of_txn_matched);
2397         return BlockNotifier_block_connected_checked(this_arg_conv, header_ref, height, txn_matched_conv, indexes_of_txn_matched_conv);
2398 }
2399
2400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_BlockNotifier_1block_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_height) {
2401         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
2402         unsigned char header_arr[80];
2403         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
2404         unsigned char (*header_ref)[80] = &header_arr;
2405         return BlockNotifier_block_disconnected(this_arg_conv, header_ref, disconnected_height);
2406 }
2407
2408 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2409         LDKChainWatchInterfaceUtil this_ptr_conv = *(LDKChainWatchInterfaceUtil*)this_ptr;
2410         FREE((void*)this_ptr);
2411         this_ptr_conv._underlying_ref = false;
2412         return ChainWatchInterfaceUtil_free(this_ptr_conv);
2413 }
2414
2415 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1as_1ChainWatchInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
2416         LDKChainWatchInterfaceUtil* this_arg_conv = (LDKChainWatchInterfaceUtil*)this_arg;
2417         LDKChainWatchInterface* ret = MALLOC(sizeof(LDKChainWatchInterface), "LDKChainWatchInterface");
2418         *ret = ChainWatchInterfaceUtil_as_ChainWatchInterface(this_arg_conv);
2419         return (long)ret;
2420 }
2421
2422 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1new(JNIEnv * _env, jclass _b, jclass network) {
2423         LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
2424         LDKChainWatchInterfaceUtil* ret = MALLOC(sizeof(LDKChainWatchInterfaceUtil), "LDKChainWatchInterfaceUtil");
2425         *ret = ChainWatchInterfaceUtil_new(network_conv);
2426         assert(!ret->_underlying_ref);
2427         ret->_underlying_ref = true;
2428         return (long)ret;
2429 }
2430
2431 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChainWatchInterfaceUtil_1does_1match_1tx(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
2432         LDKChainWatchInterfaceUtil* this_arg_conv = (LDKChainWatchInterfaceUtil*)this_arg;
2433         LDKTransaction tx_conv = *(LDKTransaction*)tx;
2434         FREE((void*)tx);
2435         return ChainWatchInterfaceUtil_does_match_tx(this_arg_conv, tx_conv);
2436 }
2437
2438 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2439         LDKOutPoint this_ptr_conv = *(LDKOutPoint*)this_ptr;
2440         FREE((void*)this_ptr);
2441         this_ptr_conv._underlying_ref = false;
2442         return OutPoint_free(this_ptr_conv);
2443 }
2444
2445 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
2446         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
2447         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2448         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(this_ptr_conv));
2449         return ret_arr;
2450 }
2451
2452 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2453         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
2454         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
2455         FREE((void*)val);
2456         return OutPoint_set_txid(this_ptr_conv, val_conv);
2457 }
2458
2459 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
2460         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
2461         return OutPoint_get_index(this_ptr_conv);
2462 }
2463
2464 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
2465         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
2466         return OutPoint_set_index(this_ptr_conv, val);
2467 }
2468
2469 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jlong txid_arg, jshort index_arg) {
2470         LDKThirtyTwoBytes txid_arg_conv = *(LDKThirtyTwoBytes*)txid_arg;
2471         FREE((void*)txid_arg);
2472         LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
2473         *ret = OutPoint_new(txid_arg_conv, index_arg);
2474         assert(!ret->_underlying_ref);
2475         ret->_underlying_ref = true;
2476         return (long)ret;
2477 }
2478
2479 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1to_1channel_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
2480         LDKOutPoint* this_arg_conv = (LDKOutPoint*)this_arg;
2481         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
2482         *ret = OutPoint_to_channel_id(this_arg_conv);
2483         return (long)ret;
2484 }
2485
2486 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1write(JNIEnv * _env, jclass _b, jlong obj) {
2487         LDKOutPoint* obj_conv = (LDKOutPoint*)obj;
2488         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2489         *ret = OutPoint_write(obj_conv);
2490         return (long)ret;
2491 }
2492
2493 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1read(JNIEnv * _env, jclass _b, jlong ser) {
2494         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2495         FREE((void*)ser);
2496         LDKOutPoint* ret = MALLOC(sizeof(LDKOutPoint), "LDKOutPoint");
2497         *ret = OutPoint_read(ser_conv);
2498         assert(!ret->_underlying_ref);
2499         ret->_underlying_ref = true;
2500         return (long)ret;
2501 }
2502
2503 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SpendableOutputDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2504         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
2505         FREE((void*)this_ptr);
2506         return SpendableOutputDescriptor_free(this_ptr_conv);
2507 }
2508
2509 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2510         LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
2511         FREE((void*)this_ptr);
2512         return ChannelKeys_free(this_ptr_conv);
2513 }
2514
2515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysInterface_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2516         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
2517         FREE((void*)this_ptr);
2518         return KeysInterface_free(this_ptr_conv);
2519 }
2520
2521 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2522         LDKInMemoryChannelKeys this_ptr_conv = *(LDKInMemoryChannelKeys*)this_ptr;
2523         FREE((void*)this_ptr);
2524         this_ptr_conv._underlying_ref = false;
2525         return InMemoryChannelKeys_free(this_ptr_conv);
2526 }
2527
2528 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
2529         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2530         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2531         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(this_ptr_conv));
2532         return ret_arr;
2533 }
2534
2535 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1funding_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2536         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2537         LDKSecretKey val_conv = *(LDKSecretKey*)val;
2538         FREE((void*)val);
2539         return InMemoryChannelKeys_set_funding_key(this_ptr_conv, val_conv);
2540 }
2541
2542 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
2543         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2544         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2545         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(this_ptr_conv));
2546         return ret_arr;
2547 }
2548
2549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1revocation_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2550         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2551         LDKSecretKey val_conv = *(LDKSecretKey*)val;
2552         FREE((void*)val);
2553         return InMemoryChannelKeys_set_revocation_base_key(this_ptr_conv, val_conv);
2554 }
2555
2556 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
2557         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2558         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2559         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(this_ptr_conv));
2560         return ret_arr;
2561 }
2562
2563 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2564         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2565         LDKSecretKey val_conv = *(LDKSecretKey*)val;
2566         FREE((void*)val);
2567         return InMemoryChannelKeys_set_payment_key(this_ptr_conv, val_conv);
2568 }
2569
2570 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
2571         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2572         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2573         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr_conv));
2574         return ret_arr;
2575 }
2576
2577 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1delayed_1payment_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2578         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2579         LDKSecretKey val_conv = *(LDKSecretKey*)val;
2580         FREE((void*)val);
2581         return InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr_conv, val_conv);
2582 }
2583
2584 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
2585         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2586         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2587         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(this_ptr_conv));
2588         return ret_arr;
2589 }
2590
2591 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1htlc_1base_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2592         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2593         LDKSecretKey val_conv = *(LDKSecretKey*)val;
2594         FREE((void*)val);
2595         return InMemoryChannelKeys_set_htlc_base_key(this_ptr_conv, val_conv);
2596 }
2597
2598 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1get_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr) {
2599         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2600         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2601         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(this_ptr_conv));
2602         return ret_arr;
2603 }
2604
2605 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1set_1commitment_1seed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2606         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
2607         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
2608         FREE((void*)val);
2609         return InMemoryChannelKeys_set_commitment_seed(this_ptr_conv, val_conv);
2610 }
2611
2612 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1new(JNIEnv * _env, jclass _b, jlong funding_key, jlong revocation_base_key, jlong payment_key, jlong delayed_payment_base_key, jlong htlc_base_key, jlong commitment_seed, jlong channel_value_satoshis, jlong key_derivation_params) {
2613         LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
2614         FREE((void*)funding_key);
2615         LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
2616         FREE((void*)revocation_base_key);
2617         LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
2618         FREE((void*)payment_key);
2619         LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
2620         FREE((void*)delayed_payment_base_key);
2621         LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
2622         FREE((void*)htlc_base_key);
2623         LDKThirtyTwoBytes commitment_seed_conv = *(LDKThirtyTwoBytes*)commitment_seed;
2624         FREE((void*)commitment_seed);
2625         LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
2626         FREE((void*)key_derivation_params);
2627         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
2628         *ret = InMemoryChannelKeys_new(funding_key_conv, revocation_base_key_conv, payment_key_conv, delayed_payment_base_key_conv, htlc_base_key_conv, commitment_seed_conv, channel_value_satoshis, key_derivation_params_conv);
2629         assert(!ret->_underlying_ref);
2630         ret->_underlying_ref = true;
2631         return (long)ret;
2632 }
2633
2634 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1remote_1pubkeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2635         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
2636         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
2637         *ret = InMemoryChannelKeys_remote_pubkeys(this_arg_conv);
2638         assert(!ret->_underlying_ref);
2639         ret->_underlying_ref = true;
2640         return (long)ret;
2641 }
2642
2643 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1remote_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
2644         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
2645         return InMemoryChannelKeys_remote_to_self_delay(this_arg_conv);
2646 }
2647
2648 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1local_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
2649         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
2650         return InMemoryChannelKeys_local_to_self_delay(this_arg_conv);
2651 }
2652
2653 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
2654         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
2655         LDKChannelKeys* ret = MALLOC(sizeof(LDKChannelKeys), "LDKChannelKeys");
2656         *ret = InMemoryChannelKeys_as_ChannelKeys(this_arg_conv);
2657         return (long)ret;
2658 }
2659
2660 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
2661         LDKInMemoryChannelKeys* obj_conv = (LDKInMemoryChannelKeys*)obj;
2662         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
2663         *ret = InMemoryChannelKeys_write(obj_conv);
2664         return (long)ret;
2665 }
2666
2667 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
2668         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2669         FREE((void*)ser);
2670         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
2671         *ret = InMemoryChannelKeys_read(ser_conv);
2672         assert(!ret->_underlying_ref);
2673         ret->_underlying_ref = true;
2674         return (long)ret;
2675 }
2676
2677 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_KeysManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2678         LDKKeysManager this_ptr_conv = *(LDKKeysManager*)this_ptr;
2679         FREE((void*)this_ptr);
2680         this_ptr_conv._underlying_ref = false;
2681         return KeysManager_free(this_ptr_conv);
2682 }
2683
2684 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) {
2685         unsigned char seed_arr[32];
2686         (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
2687         unsigned char (*seed_ref)[32] = &seed_arr;
2688         LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
2689         LDKKeysManager* ret = MALLOC(sizeof(LDKKeysManager), "LDKKeysManager");
2690         *ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
2691         assert(!ret->_underlying_ref);
2692         ret->_underlying_ref = true;
2693         return (long)ret;
2694 }
2695
2696 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) {
2697         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
2698         LDKInMemoryChannelKeys* ret = MALLOC(sizeof(LDKInMemoryChannelKeys), "LDKInMemoryChannelKeys");
2699         *ret = KeysManager_derive_channel_keys(this_arg_conv, channel_value_satoshis, params_1, params_2);
2700         assert(!ret->_underlying_ref);
2701         ret->_underlying_ref = true;
2702         return (long)ret;
2703 }
2704
2705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_KeysManager_1as_1KeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
2706         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
2707         LDKKeysInterface* ret = MALLOC(sizeof(LDKKeysInterface), "LDKKeysInterface");
2708         *ret = KeysManager_as_KeysInterface(this_arg_conv);
2709         return (long)ret;
2710 }
2711
2712 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2713         LDKChannelManager this_ptr_conv = *(LDKChannelManager*)this_ptr;
2714         FREE((void*)this_ptr);
2715         this_ptr_conv._underlying_ref = false;
2716         return ChannelManager_free(this_ptr_conv);
2717 }
2718
2719 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2720         LDKChannelDetails this_ptr_conv = *(LDKChannelDetails*)this_ptr;
2721         FREE((void*)this_ptr);
2722         this_ptr_conv._underlying_ref = false;
2723         return ChannelDetails_free(this_ptr_conv);
2724 }
2725
2726 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
2727         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2728         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
2729         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(this_ptr_conv));
2730         return ret_arr;
2731 }
2732
2733 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2734         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2735         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
2736         FREE((void*)val);
2737         return ChannelDetails_set_channel_id(this_ptr_conv, val_conv);
2738 }
2739
2740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
2741         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2742         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
2743         *ret = ChannelDetails_get_remote_network_id(this_ptr_conv);
2744         return (long)ret;
2745 }
2746
2747 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1remote_1network_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2748         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2749         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2750         FREE((void*)val);
2751         return ChannelDetails_set_remote_network_id(this_ptr_conv, val_conv);
2752 }
2753
2754 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr) {
2755         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2756         LDKInitFeatures* ret = MALLOC(sizeof(LDKInitFeatures), "LDKInitFeatures");
2757         *ret = ChannelDetails_get_counterparty_features(this_ptr_conv);
2758         assert(!ret->_underlying_ref);
2759         ret->_underlying_ref = true;
2760         return (long)ret;
2761 }
2762
2763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1counterparty_1features(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2764         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2765         LDKInitFeatures val_conv = *(LDKInitFeatures*)val;
2766         FREE((void*)val);
2767         val_conv._underlying_ref = false;
2768         return ChannelDetails_set_counterparty_features(this_ptr_conv, val_conv);
2769 }
2770
2771 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
2772         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2773         return ChannelDetails_get_channel_value_satoshis(this_ptr_conv);
2774 }
2775
2776 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1channel_1value_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2777         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2778         return ChannelDetails_set_channel_value_satoshis(this_ptr_conv, val);
2779 }
2780
2781 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
2782         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2783         return ChannelDetails_get_user_id(this_ptr_conv);
2784 }
2785
2786 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1user_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2787         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2788         return ChannelDetails_set_user_id(this_ptr_conv, val);
2789 }
2790
2791 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2792         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2793         return ChannelDetails_get_outbound_capacity_msat(this_ptr_conv);
2794 }
2795
2796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1outbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2797         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2798         return ChannelDetails_set_outbound_capacity_msat(this_ptr_conv, val);
2799 }
2800
2801 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2802         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2803         return ChannelDetails_get_inbound_capacity_msat(this_ptr_conv);
2804 }
2805
2806 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1inbound_1capacity_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2807         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2808         return ChannelDetails_set_inbound_capacity_msat(this_ptr_conv, val);
2809 }
2810
2811 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1get_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr) {
2812         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2813         return ChannelDetails_get_is_live(this_ptr_conv);
2814 }
2815
2816 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelDetails_1set_1is_1live(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
2817         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
2818         return ChannelDetails_set_is_live(this_ptr_conv, val);
2819 }
2820
2821 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PaymentSendFailure_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
2822         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)this_ptr;
2823         FREE((void*)this_ptr);
2824         this_ptr_conv._underlying_ref = false;
2825         return PaymentSendFailure_free(this_ptr_conv);
2826 }
2827
2828 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1new(JNIEnv * _env, jclass _b, jclass network, jlong fee_est, jlong monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
2829         LDKNetwork network_conv = LDKNetwork_from_java(_env, network);
2830         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
2831         LDKFeeEstimator_JCalls_clone(fee_est_conv.this_arg);
2832         LDKManyChannelMonitor monitor_conv = *(LDKManyChannelMonitor*)monitor;
2833         LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
2834         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
2835         LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
2836         LDKLogger logger_conv = *(LDKLogger*)logger;
2837         LDKLogger_JCalls_clone(logger_conv.this_arg);
2838         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
2839         LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
2840         LDKUserConfig config_conv = *(LDKUserConfig*)config;
2841         FREE((void*)config);
2842         config_conv._underlying_ref = false;
2843         uintptr_t current_blockchain_height_conv = *(uintptr_t*)current_blockchain_height;
2844         FREE((void*)current_blockchain_height);
2845         LDKChannelManager* ret = MALLOC(sizeof(LDKChannelManager), "LDKChannelManager");
2846         *ret = ChannelManager_new(network_conv, fee_est_conv, monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height_conv);
2847         assert(!ret->_underlying_ref);
2848         ret->_underlying_ref = true;
2849         return (long)ret;
2850 }
2851
2852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1create_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_network_key, jlong channel_value_satoshis, jlong push_msat, jlong user_id, jlong override_config) {
2853         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2854         LDKPublicKey their_network_key_conv = *(LDKPublicKey*)their_network_key;
2855         FREE((void*)their_network_key);
2856         LDKUserConfig override_config_conv = *(LDKUserConfig*)override_config;
2857         FREE((void*)override_config);
2858         override_config_conv._underlying_ref = false;
2859         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2860         *ret = ChannelManager_create_channel(this_arg_conv, their_network_key_conv, channel_value_satoshis, push_msat, user_id, override_config_conv);
2861         return (long)ret;
2862 }
2863
2864 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
2865         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2866         LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2867         *ret = ChannelManager_list_channels(this_arg_conv);
2868         return (long)ret;
2869 }
2870
2871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1list_1usable_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
2872         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2873         LDKCVec_ChannelDetailsZ* ret = MALLOC(sizeof(LDKCVec_ChannelDetailsZ), "LDKCVec_ChannelDetailsZ");
2874         *ret = ChannelManager_list_usable_channels(this_arg_conv);
2875         return (long)ret;
2876 }
2877
2878 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
2879         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2880         unsigned char channel_id_arr[32];
2881         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
2882         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
2883         LDKCResult_NoneAPIErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneAPIErrorZ), "LDKCResult_NoneAPIErrorZ");
2884         *ret = ChannelManager_close_channel(this_arg_conv, channel_id_ref);
2885         return (long)ret;
2886 }
2887
2888 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1channel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
2889         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2890         unsigned char channel_id_arr[32];
2891         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
2892         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
2893         return ChannelManager_force_close_channel(this_arg_conv, channel_id_ref);
2894 }
2895
2896 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1force_1close_1all_1channels(JNIEnv * _env, jclass _b, jlong this_arg) {
2897         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2898         return ChannelManager_force_close_all_channels(this_arg_conv);
2899 }
2900
2901 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1send_1payment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jlong payment_hash, jlong payment_secret) {
2902         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2903         LDKRoute* route_conv = (LDKRoute*)route;
2904         LDKThirtyTwoBytes payment_hash_conv = *(LDKThirtyTwoBytes*)payment_hash;
2905         FREE((void*)payment_hash);
2906         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
2907         FREE((void*)payment_secret);
2908         LDKCResult_NonePaymentSendFailureZ* ret = MALLOC(sizeof(LDKCResult_NonePaymentSendFailureZ), "LDKCResult_NonePaymentSendFailureZ");
2909         *ret = ChannelManager_send_payment(this_arg_conv, route_conv, payment_hash_conv, payment_secret_conv);
2910         return (long)ret;
2911 }
2912
2913 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) {
2914         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2915         unsigned char temporary_channel_id_arr[32];
2916         (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
2917         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
2918         LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
2919         FREE((void*)funding_txo);
2920         funding_txo_conv._underlying_ref = false;
2921         return ChannelManager_funding_transaction_generated(this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
2922 }
2923
2924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1broadcast_1node_1announcement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jlong alias, jlong addresses) {
2925         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2926         LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
2927         FREE((void*)rgb);
2928         LDKThirtyTwoBytes alias_conv = *(LDKThirtyTwoBytes*)alias;
2929         FREE((void*)alias);
2930         LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
2931         FREE((void*)addresses);
2932         return ChannelManager_broadcast_node_announcement(this_arg_conv, rgb_conv, alias_conv, addresses_conv);
2933 }
2934
2935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1process_1pending_1htlc_1forwards(JNIEnv * _env, jclass _b, jlong this_arg) {
2936         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2937         return ChannelManager_process_pending_htlc_forwards(this_arg_conv);
2938 }
2939
2940 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManager_1timer_1chan_1freshness_1every_1min(JNIEnv * _env, jclass _b, jlong this_arg) {
2941         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2942         return ChannelManager_timer_chan_freshness_every_min(this_arg_conv);
2943 }
2944
2945 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1fail_1htlc_1backwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jlong payment_secret) {
2946         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2947         unsigned char payment_hash_arr[32];
2948         (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
2949         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
2950         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
2951         FREE((void*)payment_secret);
2952         return ChannelManager_fail_htlc_backwards(this_arg_conv, payment_hash_ref, payment_secret_conv);
2953 }
2954
2955 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_ChannelManager_1claim_1funds(JNIEnv * _env, jclass _b, jlong this_arg, jlong payment_preimage, jlong payment_secret, jlong expected_amount) {
2956         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2957         LDKThirtyTwoBytes payment_preimage_conv = *(LDKThirtyTwoBytes*)payment_preimage;
2958         FREE((void*)payment_preimage);
2959         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
2960         FREE((void*)payment_secret);
2961         return ChannelManager_claim_funds(this_arg_conv, payment_preimage_conv, payment_secret_conv, expected_amount);
2962 }
2963
2964 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1get_1our_1node_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
2965         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2966         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
2967         *ret = ChannelManager_get_our_node_id(this_arg_conv);
2968         return (long)ret;
2969 }
2970
2971 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) {
2972         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2973         LDKOutPoint* funding_txo_conv = (LDKOutPoint*)funding_txo;
2974         return ChannelManager_channel_monitor_updated(this_arg_conv, funding_txo_conv, highest_applied_update_id);
2975 }
2976
2977 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1MessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
2978         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2979         LDKMessageSendEventsProvider* ret = MALLOC(sizeof(LDKMessageSendEventsProvider), "LDKMessageSendEventsProvider");
2980         *ret = ChannelManager_as_MessageSendEventsProvider(this_arg_conv);
2981         return (long)ret;
2982 }
2983
2984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1EventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
2985         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2986         LDKEventsProvider* ret = MALLOC(sizeof(LDKEventsProvider), "LDKEventsProvider");
2987         *ret = ChannelManager_as_EventsProvider(this_arg_conv);
2988         return (long)ret;
2989 }
2990
2991 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChainListener(JNIEnv * _env, jclass _b, jlong this_arg) {
2992         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
2993         LDKChainListener* ret = MALLOC(sizeof(LDKChainListener), "LDKChainListener");
2994         *ret = ChannelManager_as_ChainListener(this_arg_conv);
2995         return (long)ret;
2996 }
2997
2998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManager_1as_1ChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
2999         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
3000         LDKChannelMessageHandler* ret = MALLOC(sizeof(LDKChannelMessageHandler), "LDKChannelMessageHandler");
3001         *ret = ChannelManager_as_ChannelMessageHandler(this_arg_conv);
3002         return (long)ret;
3003 }
3004
3005 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3006         LDKChannelManagerReadArgs this_ptr_conv = *(LDKChannelManagerReadArgs*)this_ptr;
3007         FREE((void*)this_ptr);
3008         this_ptr_conv._underlying_ref = false;
3009         return ChannelManagerReadArgs_free(this_ptr_conv);
3010 }
3011
3012 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
3013         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3014         long ret = (long)ChannelManagerReadArgs_get_keys_manager(this_ptr_conv);
3015         return ret;
3016 }
3017
3018 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3019         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3020         LDKKeysInterface val_conv = *(LDKKeysInterface*)val;
3021         LDKKeysInterface_JCalls_clone(val_conv.this_arg);
3022         return ChannelManagerReadArgs_set_keys_manager(this_ptr_conv, val_conv);
3023 }
3024
3025 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
3026         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3027         long ret = (long)ChannelManagerReadArgs_get_fee_estimator(this_ptr_conv);
3028         return ret;
3029 }
3030
3031 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3032         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3033         LDKFeeEstimator val_conv = *(LDKFeeEstimator*)val;
3034         LDKFeeEstimator_JCalls_clone(val_conv.this_arg);
3035         return ChannelManagerReadArgs_set_fee_estimator(this_ptr_conv, val_conv);
3036 }
3037
3038 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
3039         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3040         long ret = (long)ChannelManagerReadArgs_get_monitor(this_ptr_conv);
3041         return ret;
3042 }
3043
3044 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3045         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3046         LDKManyChannelMonitor val_conv = *(LDKManyChannelMonitor*)val;
3047         LDKManyChannelMonitor_JCalls_clone(val_conv.this_arg);
3048         return ChannelManagerReadArgs_set_monitor(this_ptr_conv, val_conv);
3049 }
3050
3051 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
3052         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3053         long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(this_ptr_conv);
3054         return ret;
3055 }
3056
3057 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3058         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3059         LDKBroadcasterInterface val_conv = *(LDKBroadcasterInterface*)val;
3060         LDKBroadcasterInterface_JCalls_clone(val_conv.this_arg);
3061         return ChannelManagerReadArgs_set_tx_broadcaster(this_ptr_conv, val_conv);
3062 }
3063
3064 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
3065         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3066         long ret = (long)ChannelManagerReadArgs_get_logger(this_ptr_conv);
3067         return ret;
3068 }
3069
3070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3071         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3072         LDKLogger val_conv = *(LDKLogger*)val;
3073         LDKLogger_JCalls_clone(val_conv.this_arg);
3074         return ChannelManagerReadArgs_set_logger(this_ptr_conv, val_conv);
3075 }
3076
3077 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr) {
3078         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3079         LDKUserConfig* ret = MALLOC(sizeof(LDKUserConfig), "LDKUserConfig");
3080         *ret = ChannelManagerReadArgs_get_default_config(this_ptr_conv);
3081         assert(!ret->_underlying_ref);
3082         ret->_underlying_ref = true;
3083         return (long)ret;
3084 }
3085
3086 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1default_1config(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3087         LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
3088         LDKUserConfig val_conv = *(LDKUserConfig*)val;
3089         FREE((void*)val);
3090         val_conv._underlying_ref = false;
3091         return ChannelManagerReadArgs_set_default_config(this_ptr_conv, val_conv);
3092 }
3093
3094 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1new(JNIEnv * _env, jclass _b, jlong keys_manager, jlong fee_estimator, jlong monitor, jlong tx_broadcaster, jlong logger, jlong default_config, jlong channel_monitors) {
3095         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
3096         LDKKeysInterface_JCalls_clone(keys_manager_conv.this_arg);
3097         LDKFeeEstimator fee_estimator_conv = *(LDKFeeEstimator*)fee_estimator;
3098         LDKFeeEstimator_JCalls_clone(fee_estimator_conv.this_arg);
3099         LDKManyChannelMonitor monitor_conv = *(LDKManyChannelMonitor*)monitor;
3100         LDKManyChannelMonitor_JCalls_clone(monitor_conv.this_arg);
3101         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
3102         LDKBroadcasterInterface_JCalls_clone(tx_broadcaster_conv.this_arg);
3103         LDKLogger logger_conv = *(LDKLogger*)logger;
3104         LDKLogger_JCalls_clone(logger_conv.this_arg);
3105         LDKUserConfig default_config_conv = *(LDKUserConfig*)default_config;
3106         FREE((void*)default_config);
3107         default_config_conv._underlying_ref = false;
3108         LDKCVec_ChannelMonitorZ channel_monitors_conv = *(LDKCVec_ChannelMonitorZ*)channel_monitors;
3109         FREE((void*)channel_monitors);
3110         LDKChannelManagerReadArgs* ret = MALLOC(sizeof(LDKChannelManagerReadArgs), "LDKChannelManagerReadArgs");
3111         *ret = ChannelManagerReadArgs_new(keys_manager_conv, fee_estimator_conv, monitor_conv, tx_broadcaster_conv, logger_conv, default_config_conv, channel_monitors_conv);
3112         assert(!ret->_underlying_ref);
3113         ret->_underlying_ref = true;
3114         return (long)ret;
3115 }
3116
3117 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3118         LDKChannelMonitorUpdate this_ptr_conv = *(LDKChannelMonitorUpdate*)this_ptr;
3119         FREE((void*)this_ptr);
3120         this_ptr_conv._underlying_ref = false;
3121         return ChannelMonitorUpdate_free(this_ptr_conv);
3122 }
3123
3124 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1get_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3125         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
3126         return ChannelMonitorUpdate_get_update_id(this_ptr_conv);
3127 }
3128
3129 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1set_1update_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3130         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
3131         return ChannelMonitorUpdate_set_update_id(this_ptr_conv, val);
3132 }
3133
3134 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
3135         LDKChannelMonitorUpdate* obj_conv = (LDKChannelMonitorUpdate*)obj;
3136         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3137         *ret = ChannelMonitorUpdate_write(obj_conv);
3138         return (long)ret;
3139 }
3140
3141 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitorUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
3142         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3143         FREE((void*)ser);
3144         LDKChannelMonitorUpdate* ret = MALLOC(sizeof(LDKChannelMonitorUpdate), "LDKChannelMonitorUpdate");
3145         *ret = ChannelMonitorUpdate_read(ser_conv);
3146         assert(!ret->_underlying_ref);
3147         ret->_underlying_ref = true;
3148         return (long)ret;
3149 }
3150
3151 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorUpdateError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3152         LDKMonitorUpdateError this_ptr_conv = *(LDKMonitorUpdateError*)this_ptr;
3153         FREE((void*)this_ptr);
3154         this_ptr_conv._underlying_ref = false;
3155         return MonitorUpdateError_free(this_ptr_conv);
3156 }
3157
3158 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MonitorEvent_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3159         LDKMonitorEvent this_ptr_conv = *(LDKMonitorEvent*)this_ptr;
3160         FREE((void*)this_ptr);
3161         this_ptr_conv._underlying_ref = false;
3162         return MonitorEvent_free(this_ptr_conv);
3163 }
3164
3165 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3166         LDKHTLCUpdate this_ptr_conv = *(LDKHTLCUpdate*)this_ptr;
3167         FREE((void*)this_ptr);
3168         this_ptr_conv._underlying_ref = false;
3169         return HTLCUpdate_free(this_ptr_conv);
3170 }
3171
3172 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
3173         LDKHTLCUpdate* obj_conv = (LDKHTLCUpdate*)obj;
3174         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
3175         *ret = HTLCUpdate_write(obj_conv);
3176         return (long)ret;
3177 }
3178
3179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
3180         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3181         FREE((void*)ser);
3182         LDKHTLCUpdate* ret = MALLOC(sizeof(LDKHTLCUpdate), "LDKHTLCUpdate");
3183         *ret = HTLCUpdate_read(ser_conv);
3184         assert(!ret->_underlying_ref);
3185         ret->_underlying_ref = true;
3186         return (long)ret;
3187 }
3188
3189 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3190         LDKChannelMonitor this_ptr_conv = *(LDKChannelMonitor*)this_ptr;
3191         FREE((void*)this_ptr);
3192         this_ptr_conv._underlying_ref = false;
3193         return ChannelMonitor_free(this_ptr_conv);
3194 }
3195
3196 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ManyChannelMonitor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3197         LDKManyChannelMonitor this_ptr_conv = *(LDKManyChannelMonitor*)this_ptr;
3198         FREE((void*)this_ptr);
3199         return ManyChannelMonitor_free(this_ptr_conv);
3200 }
3201
3202 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1update_1monitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
3203         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3204         LDKChannelMonitorUpdate updates_conv = *(LDKChannelMonitorUpdate*)updates;
3205         FREE((void*)updates);
3206         updates_conv._underlying_ref = false;
3207         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
3208         LDKLogger* logger_conv = (LDKLogger*)logger;
3209         LDKCResult_NoneMonitorUpdateErrorZ* ret = MALLOC(sizeof(LDKCResult_NoneMonitorUpdateErrorZ), "LDKCResult_NoneMonitorUpdateErrorZ");
3210         *ret = ChannelMonitor_update_monitor(this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
3211         return (long)ret;
3212 }
3213
3214 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1update_1id(JNIEnv * _env, jclass _b, jlong this_arg) {
3215         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3216         return ChannelMonitor_get_latest_update_id(this_arg_conv);
3217 }
3218
3219 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1funding_1txo(JNIEnv * _env, jclass _b, jlong this_arg) {
3220         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3221         LDKC2Tuple_OutPointScriptZ* ret = MALLOC(sizeof(LDKC2Tuple_OutPointScriptZ), "LDKC2Tuple_OutPointScriptZ");
3222         *ret = ChannelMonitor_get_funding_txo(this_arg_conv);
3223         return (long)ret;
3224 }
3225
3226 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1monitor_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3227         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3228         LDKCVec_MonitorEventZ* ret = MALLOC(sizeof(LDKCVec_MonitorEventZ), "LDKCVec_MonitorEventZ");
3229         *ret = ChannelMonitor_get_and_clear_pending_monitor_events(this_arg_conv);
3230         return (long)ret;
3231 }
3232
3233 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1and_1clear_1pending_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
3234         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3235         LDKCVec_EventZ* ret = MALLOC(sizeof(LDKCVec_EventZ), "LDKCVec_EventZ");
3236         *ret = ChannelMonitor_get_and_clear_pending_events(this_arg_conv);
3237         return (long)ret;
3238 }
3239
3240 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelMonitor_1get_1latest_1local_1commitment_1txn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
3241         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
3242         LDKLogger* logger_conv = (LDKLogger*)logger;
3243         LDKCVec_TransactionZ* ret = MALLOC(sizeof(LDKCVec_TransactionZ), "LDKCVec_TransactionZ");
3244         *ret = ChannelMonitor_get_latest_local_commitment_txn(this_arg_conv, logger_conv);
3245         return (long)ret;
3246 }
3247
3248 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DecodeError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3249         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)this_ptr;
3250         FREE((void*)this_ptr);
3251         this_ptr_conv._underlying_ref = false;
3252         return DecodeError_free(this_ptr_conv);
3253 }
3254
3255 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Init_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3256         LDKInit this_ptr_conv = *(LDKInit*)this_ptr;
3257         FREE((void*)this_ptr);
3258         this_ptr_conv._underlying_ref = false;
3259         return Init_free(this_ptr_conv);
3260 }
3261
3262 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3263         LDKErrorMessage this_ptr_conv = *(LDKErrorMessage*)this_ptr;
3264         FREE((void*)this_ptr);
3265         this_ptr_conv._underlying_ref = false;
3266         return ErrorMessage_free(this_ptr_conv);
3267 }
3268
3269 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3270         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
3271         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3272         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ErrorMessage_get_channel_id(this_ptr_conv));
3273         return ret_arr;
3274 }
3275
3276 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3277         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
3278         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3279         FREE((void*)val);
3280         return ErrorMessage_set_channel_id(this_ptr_conv, val_conv);
3281 }
3282
3283 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1get_1data(JNIEnv * _env, jclass _b, jlong this_ptr) {
3284         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
3285         LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
3286         *ret = ErrorMessage_get_data(this_ptr_conv);
3287         return (long)ret;
3288 }
3289
3290 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1set_1data(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3291         LDKErrorMessage* this_ptr_conv = (LDKErrorMessage*)this_ptr;
3292         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
3293         FREE((void*)val);
3294         return ErrorMessage_set_data(this_ptr_conv, val_conv);
3295 }
3296
3297 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong data_arg) {
3298         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
3299         FREE((void*)channel_id_arg);
3300         LDKCVec_u8Z data_arg_conv = *(LDKCVec_u8Z*)data_arg;
3301         FREE((void*)data_arg);
3302         LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
3303         *ret = ErrorMessage_new(channel_id_arg_conv, data_arg_conv);
3304         assert(!ret->_underlying_ref);
3305         ret->_underlying_ref = true;
3306         return (long)ret;
3307 }
3308
3309 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3310         LDKPing this_ptr_conv = *(LDKPing*)this_ptr;
3311         FREE((void*)this_ptr);
3312         this_ptr_conv._underlying_ref = false;
3313         return Ping_free(this_ptr_conv);
3314 }
3315
3316 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
3317         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
3318         return Ping_get_ponglen(this_ptr_conv);
3319 }
3320
3321 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3322         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
3323         return Ping_set_ponglen(this_ptr_conv, val);
3324 }
3325
3326 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
3327         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
3328         return Ping_get_byteslen(this_ptr_conv);
3329 }
3330
3331 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3332         LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
3333         return Ping_set_byteslen(this_ptr_conv, val);
3334 }
3335
3336 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
3337         LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
3338         *ret = Ping_new(ponglen_arg, byteslen_arg);
3339         assert(!ret->_underlying_ref);
3340         ret->_underlying_ref = true;
3341         return (long)ret;
3342 }
3343
3344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3345         LDKPong this_ptr_conv = *(LDKPong*)this_ptr;
3346         FREE((void*)this_ptr);
3347         this_ptr_conv._underlying_ref = false;
3348         return Pong_free(this_ptr_conv);
3349 }
3350
3351 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
3352         LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
3353         return Pong_get_byteslen(this_ptr_conv);
3354 }
3355
3356 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3357         LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
3358         return Pong_set_byteslen(this_ptr_conv, val);
3359 }
3360
3361 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
3362         LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
3363         *ret = Pong_new(byteslen_arg);
3364         assert(!ret->_underlying_ref);
3365         ret->_underlying_ref = true;
3366         return (long)ret;
3367 }
3368
3369 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3370         LDKOpenChannel this_ptr_conv = *(LDKOpenChannel*)this_ptr;
3371         FREE((void*)this_ptr);
3372         this_ptr_conv._underlying_ref = false;
3373         return OpenChannel_free(this_ptr_conv);
3374 }
3375
3376 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
3377         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3378         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3379         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_chain_hash(this_ptr_conv));
3380         return ret_arr;
3381 }
3382
3383 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3384         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3385         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3386         FREE((void*)val);
3387         return OpenChannel_set_chain_hash(this_ptr_conv, val_conv);
3388 }
3389
3390 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3391         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3392         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3393         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OpenChannel_get_temporary_channel_id(this_ptr_conv));
3394         return ret_arr;
3395 }
3396
3397 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3398         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3399         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3400         FREE((void*)val);
3401         return OpenChannel_set_temporary_channel_id(this_ptr_conv, val_conv);
3402 }
3403
3404 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3405         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3406         return OpenChannel_get_funding_satoshis(this_ptr_conv);
3407 }
3408
3409 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3410         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3411         return OpenChannel_set_funding_satoshis(this_ptr_conv, val);
3412 }
3413
3414 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3415         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3416         return OpenChannel_get_push_msat(this_ptr_conv);
3417 }
3418
3419 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1push_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3420         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3421         return OpenChannel_set_push_msat(this_ptr_conv, val);
3422 }
3423
3424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3425         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3426         return OpenChannel_get_dust_limit_satoshis(this_ptr_conv);
3427 }
3428
3429 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3430         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3431         return OpenChannel_set_dust_limit_satoshis(this_ptr_conv, val);
3432 }
3433
3434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3435         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3436         return OpenChannel_get_max_htlc_value_in_flight_msat(this_ptr_conv);
3437 }
3438
3439 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) {
3440         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3441         return OpenChannel_set_max_htlc_value_in_flight_msat(this_ptr_conv, val);
3442 }
3443
3444 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3445         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3446         return OpenChannel_get_channel_reserve_satoshis(this_ptr_conv);
3447 }
3448
3449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3450         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3451         return OpenChannel_set_channel_reserve_satoshis(this_ptr_conv, val);
3452 }
3453
3454 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3455         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3456         return OpenChannel_get_htlc_minimum_msat(this_ptr_conv);
3457 }
3458
3459 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3460         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3461         return OpenChannel_set_htlc_minimum_msat(this_ptr_conv, val);
3462 }
3463
3464 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
3465         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3466         return OpenChannel_get_feerate_per_kw(this_ptr_conv);
3467 }
3468
3469 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3470         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3471         return OpenChannel_set_feerate_per_kw(this_ptr_conv, val);
3472 }
3473
3474 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
3475         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3476         return OpenChannel_get_to_self_delay(this_ptr_conv);
3477 }
3478
3479 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3480         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3481         return OpenChannel_set_to_self_delay(this_ptr_conv, val);
3482 }
3483
3484 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
3485         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3486         return OpenChannel_get_max_accepted_htlcs(this_ptr_conv);
3487 }
3488
3489 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3490         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3491         return OpenChannel_set_max_accepted_htlcs(this_ptr_conv, val);
3492 }
3493
3494 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
3495         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3496         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3497         *ret = OpenChannel_get_funding_pubkey(this_ptr_conv);
3498         return (long)ret;
3499 }
3500
3501 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3502         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3503         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3504         FREE((void*)val);
3505         return OpenChannel_set_funding_pubkey(this_ptr_conv, val_conv);
3506 }
3507
3508 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3509         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3510         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3511         *ret = OpenChannel_get_revocation_basepoint(this_ptr_conv);
3512         return (long)ret;
3513 }
3514
3515 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3516         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3517         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3518         FREE((void*)val);
3519         return OpenChannel_set_revocation_basepoint(this_ptr_conv, val_conv);
3520 }
3521
3522 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
3523         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3524         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3525         *ret = OpenChannel_get_payment_point(this_ptr_conv);
3526         return (long)ret;
3527 }
3528
3529 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3530         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3531         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3532         FREE((void*)val);
3533         return OpenChannel_set_payment_point(this_ptr_conv, val_conv);
3534 }
3535
3536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3537         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3538         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3539         *ret = OpenChannel_get_delayed_payment_basepoint(this_ptr_conv);
3540         return (long)ret;
3541 }
3542
3543 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3544         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3545         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3546         FREE((void*)val);
3547         return OpenChannel_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
3548 }
3549
3550 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3551         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3552         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3553         *ret = OpenChannel_get_htlc_basepoint(this_ptr_conv);
3554         return (long)ret;
3555 }
3556
3557 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3558         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3559         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3560         FREE((void*)val);
3561         return OpenChannel_set_htlc_basepoint(this_ptr_conv, val_conv);
3562 }
3563
3564 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
3565         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3566         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3567         *ret = OpenChannel_get_first_per_commitment_point(this_ptr_conv);
3568         return (long)ret;
3569 }
3570
3571 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3572         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3573         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3574         FREE((void*)val);
3575         return OpenChannel_set_first_per_commitment_point(this_ptr_conv, val_conv);
3576 }
3577
3578 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
3579         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3580         return OpenChannel_get_channel_flags(this_ptr_conv);
3581 }
3582
3583 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1channel_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
3584         LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
3585         return OpenChannel_set_channel_flags(this_ptr_conv, val);
3586 }
3587
3588 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3589         LDKAcceptChannel this_ptr_conv = *(LDKAcceptChannel*)this_ptr;
3590         FREE((void*)this_ptr);
3591         this_ptr_conv._underlying_ref = false;
3592         return AcceptChannel_free(this_ptr_conv);
3593 }
3594
3595 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3596         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3597         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3598         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AcceptChannel_get_temporary_channel_id(this_ptr_conv));
3599         return ret_arr;
3600 }
3601
3602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3603         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3604         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3605         FREE((void*)val);
3606         return AcceptChannel_set_temporary_channel_id(this_ptr_conv, val_conv);
3607 }
3608
3609 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3610         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3611         return AcceptChannel_get_dust_limit_satoshis(this_ptr_conv);
3612 }
3613
3614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3615         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3616         return AcceptChannel_set_dust_limit_satoshis(this_ptr_conv, val);
3617 }
3618
3619 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1htlc_1value_1in_1flight_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3620         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3621         return AcceptChannel_get_max_htlc_value_in_flight_msat(this_ptr_conv);
3622 }
3623
3624 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) {
3625         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3626         return AcceptChannel_set_max_htlc_value_in_flight_msat(this_ptr_conv, val);
3627 }
3628
3629 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3630         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3631         return AcceptChannel_get_channel_reserve_satoshis(this_ptr_conv);
3632 }
3633
3634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1channel_1reserve_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3635         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3636         return AcceptChannel_set_channel_reserve_satoshis(this_ptr_conv, val);
3637 }
3638
3639 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
3640         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3641         return AcceptChannel_get_htlc_minimum_msat(this_ptr_conv);
3642 }
3643
3644 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3645         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3646         return AcceptChannel_set_htlc_minimum_msat(this_ptr_conv, val);
3647 }
3648
3649 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr) {
3650         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3651         return AcceptChannel_get_minimum_depth(this_ptr_conv);
3652 }
3653
3654 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1depth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3655         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3656         return AcceptChannel_set_minimum_depth(this_ptr_conv, val);
3657 }
3658
3659 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
3660         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3661         return AcceptChannel_get_to_self_delay(this_ptr_conv);
3662 }
3663
3664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3665         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3666         return AcceptChannel_set_to_self_delay(this_ptr_conv, val);
3667 }
3668
3669 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
3670         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3671         return AcceptChannel_get_max_accepted_htlcs(this_ptr_conv);
3672 }
3673
3674 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3675         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3676         return AcceptChannel_set_max_accepted_htlcs(this_ptr_conv, val);
3677 }
3678
3679 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
3680         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3681         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3682         *ret = AcceptChannel_get_funding_pubkey(this_ptr_conv);
3683         return (long)ret;
3684 }
3685
3686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3687         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3688         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3689         FREE((void*)val);
3690         return AcceptChannel_set_funding_pubkey(this_ptr_conv, val_conv);
3691 }
3692
3693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3694         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3695         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3696         *ret = AcceptChannel_get_revocation_basepoint(this_ptr_conv);
3697         return (long)ret;
3698 }
3699
3700 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3701         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3702         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3703         FREE((void*)val);
3704         return AcceptChannel_set_revocation_basepoint(this_ptr_conv, val_conv);
3705 }
3706
3707 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
3708         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3709         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3710         *ret = AcceptChannel_get_payment_point(this_ptr_conv);
3711         return (long)ret;
3712 }
3713
3714 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3715         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3716         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3717         FREE((void*)val);
3718         return AcceptChannel_set_payment_point(this_ptr_conv, val_conv);
3719 }
3720
3721 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3722         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3723         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3724         *ret = AcceptChannel_get_delayed_payment_basepoint(this_ptr_conv);
3725         return (long)ret;
3726 }
3727
3728 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3729         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3730         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3731         FREE((void*)val);
3732         return AcceptChannel_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
3733 }
3734
3735 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
3736         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3737         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3738         *ret = AcceptChannel_get_htlc_basepoint(this_ptr_conv);
3739         return (long)ret;
3740 }
3741
3742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3743         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3744         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3745         FREE((void*)val);
3746         return AcceptChannel_set_htlc_basepoint(this_ptr_conv, val_conv);
3747 }
3748
3749 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
3750         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3751         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3752         *ret = AcceptChannel_get_first_per_commitment_point(this_ptr_conv);
3753         return (long)ret;
3754 }
3755
3756 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1first_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3757         LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
3758         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3759         FREE((void*)val);
3760         return AcceptChannel_set_first_per_commitment_point(this_ptr_conv, val_conv);
3761 }
3762
3763 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3764         LDKFundingCreated this_ptr_conv = *(LDKFundingCreated*)this_ptr;
3765         FREE((void*)this_ptr);
3766         this_ptr_conv._underlying_ref = false;
3767         return FundingCreated_free(this_ptr_conv);
3768 }
3769
3770 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3771         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3772         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3773         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_temporary_channel_id(this_ptr_conv));
3774         return ret_arr;
3775 }
3776
3777 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1temporary_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3778         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3779         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3780         FREE((void*)val);
3781         return FundingCreated_set_temporary_channel_id(this_ptr_conv, val_conv);
3782 }
3783
3784 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr) {
3785         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3786         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3787         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingCreated_get_funding_txid(this_ptr_conv));
3788         return ret_arr;
3789 }
3790
3791 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1txid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3792         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3793         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3794         FREE((void*)val);
3795         return FundingCreated_set_funding_txid(this_ptr_conv, val_conv);
3796 }
3797
3798 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
3799         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3800         return FundingCreated_get_funding_output_index(this_ptr_conv);
3801 }
3802
3803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
3804         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3805         return FundingCreated_set_funding_output_index(this_ptr_conv, val);
3806 }
3807
3808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
3809         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3810         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
3811         *ret = FundingCreated_get_signature(this_ptr_conv);
3812         return (long)ret;
3813 }
3814
3815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3816         LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
3817         LDKSignature val_conv = *(LDKSignature*)val;
3818         FREE((void*)val);
3819         return FundingCreated_set_signature(this_ptr_conv, val_conv);
3820 }
3821
3822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jlong temporary_channel_id_arg, jlong funding_txid_arg, jshort funding_output_index_arg, jlong signature_arg) {
3823         LDKThirtyTwoBytes temporary_channel_id_arg_conv = *(LDKThirtyTwoBytes*)temporary_channel_id_arg;
3824         FREE((void*)temporary_channel_id_arg);
3825         LDKThirtyTwoBytes funding_txid_arg_conv = *(LDKThirtyTwoBytes*)funding_txid_arg;
3826         FREE((void*)funding_txid_arg);
3827         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
3828         FREE((void*)signature_arg);
3829         LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
3830         *ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg, signature_arg_conv);
3831         assert(!ret->_underlying_ref);
3832         ret->_underlying_ref = true;
3833         return (long)ret;
3834 }
3835
3836 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3837         LDKFundingSigned this_ptr_conv = *(LDKFundingSigned*)this_ptr;
3838         FREE((void*)this_ptr);
3839         this_ptr_conv._underlying_ref = false;
3840         return FundingSigned_free(this_ptr_conv);
3841 }
3842
3843 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3844         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
3845         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3846         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingSigned_get_channel_id(this_ptr_conv));
3847         return ret_arr;
3848 }
3849
3850 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3851         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
3852         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3853         FREE((void*)val);
3854         return FundingSigned_set_channel_id(this_ptr_conv, val_conv);
3855 }
3856
3857 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
3858         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
3859         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
3860         *ret = FundingSigned_get_signature(this_ptr_conv);
3861         return (long)ret;
3862 }
3863
3864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3865         LDKFundingSigned* this_ptr_conv = (LDKFundingSigned*)this_ptr;
3866         LDKSignature val_conv = *(LDKSignature*)val;
3867         FREE((void*)val);
3868         return FundingSigned_set_signature(this_ptr_conv, val_conv);
3869 }
3870
3871 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg) {
3872         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
3873         FREE((void*)channel_id_arg);
3874         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
3875         FREE((void*)signature_arg);
3876         LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
3877         *ret = FundingSigned_new(channel_id_arg_conv, signature_arg_conv);
3878         assert(!ret->_underlying_ref);
3879         ret->_underlying_ref = true;
3880         return (long)ret;
3881 }
3882
3883 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3884         LDKFundingLocked this_ptr_conv = *(LDKFundingLocked*)this_ptr;
3885         FREE((void*)this_ptr);
3886         this_ptr_conv._underlying_ref = false;
3887         return FundingLocked_free(this_ptr_conv);
3888 }
3889
3890 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3891         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
3892         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3893         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(this_ptr_conv));
3894         return ret_arr;
3895 }
3896
3897 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3898         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
3899         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3900         FREE((void*)val);
3901         return FundingLocked_set_channel_id(this_ptr_conv, val_conv);
3902 }
3903
3904 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
3905         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
3906         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
3907         *ret = FundingLocked_get_next_per_commitment_point(this_ptr_conv);
3908         return (long)ret;
3909 }
3910
3911 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingLocked_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3912         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
3913         LDKPublicKey val_conv = *(LDKPublicKey*)val;
3914         FREE((void*)val);
3915         return FundingLocked_set_next_per_commitment_point(this_ptr_conv, val_conv);
3916 }
3917
3918 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong next_per_commitment_point_arg) {
3919         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
3920         FREE((void*)channel_id_arg);
3921         LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
3922         FREE((void*)next_per_commitment_point_arg);
3923         LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
3924         *ret = FundingLocked_new(channel_id_arg_conv, next_per_commitment_point_arg_conv);
3925         assert(!ret->_underlying_ref);
3926         ret->_underlying_ref = true;
3927         return (long)ret;
3928 }
3929
3930 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3931         LDKShutdown this_ptr_conv = *(LDKShutdown*)this_ptr;
3932         FREE((void*)this_ptr);
3933         this_ptr_conv._underlying_ref = false;
3934         return Shutdown_free(this_ptr_conv);
3935 }
3936
3937 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3938         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
3939         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3940         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *Shutdown_get_channel_id(this_ptr_conv));
3941         return ret_arr;
3942 }
3943
3944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3945         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
3946         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3947         FREE((void*)val);
3948         return Shutdown_set_channel_id(this_ptr_conv, val_conv);
3949 }
3950
3951 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1get_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
3952         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
3953         LDKu8slice* ret = MALLOC(sizeof(LDKu8slice), "LDKu8slice");
3954         *ret = Shutdown_get_scriptpubkey(this_ptr_conv);
3955         return (long)ret;
3956 }
3957
3958 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Shutdown_1set_1scriptpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3959         LDKShutdown* this_ptr_conv = (LDKShutdown*)this_ptr;
3960         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
3961         FREE((void*)val);
3962         return Shutdown_set_scriptpubkey(this_ptr_conv, val_conv);
3963 }
3964
3965 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong scriptpubkey_arg) {
3966         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
3967         FREE((void*)channel_id_arg);
3968         LDKCVec_u8Z scriptpubkey_arg_conv = *(LDKCVec_u8Z*)scriptpubkey_arg;
3969         FREE((void*)scriptpubkey_arg);
3970         LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
3971         *ret = Shutdown_new(channel_id_arg_conv, scriptpubkey_arg_conv);
3972         assert(!ret->_underlying_ref);
3973         ret->_underlying_ref = true;
3974         return (long)ret;
3975 }
3976
3977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
3978         LDKClosingSigned this_ptr_conv = *(LDKClosingSigned*)this_ptr;
3979         FREE((void*)this_ptr);
3980         this_ptr_conv._underlying_ref = false;
3981         return ClosingSigned_free(this_ptr_conv);
3982 }
3983
3984 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
3985         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
3986         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
3987         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ClosingSigned_get_channel_id(this_ptr_conv));
3988         return ret_arr;
3989 }
3990
3991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3992         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
3993         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3994         FREE((void*)val);
3995         return ClosingSigned_set_channel_id(this_ptr_conv, val_conv);
3996 }
3997
3998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
3999         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
4000         return ClosingSigned_get_fee_satoshis(this_ptr_conv);
4001 }
4002
4003 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1fee_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4004         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
4005         return ClosingSigned_set_fee_satoshis(this_ptr_conv, val);
4006 }
4007
4008 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4009         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
4010         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4011         *ret = ClosingSigned_get_signature(this_ptr_conv);
4012         return (long)ret;
4013 }
4014
4015 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4016         LDKClosingSigned* this_ptr_conv = (LDKClosingSigned*)this_ptr;
4017         LDKSignature val_conv = *(LDKSignature*)val;
4018         FREE((void*)val);
4019         return ClosingSigned_set_signature(this_ptr_conv, val_conv);
4020 }
4021
4022 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong fee_satoshis_arg, jlong signature_arg) {
4023         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4024         FREE((void*)channel_id_arg);
4025         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
4026         FREE((void*)signature_arg);
4027         LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
4028         *ret = ClosingSigned_new(channel_id_arg_conv, fee_satoshis_arg, signature_arg_conv);
4029         assert(!ret->_underlying_ref);
4030         ret->_underlying_ref = true;
4031         return (long)ret;
4032 }
4033
4034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4035         LDKUpdateAddHTLC this_ptr_conv = *(LDKUpdateAddHTLC*)this_ptr;
4036         FREE((void*)this_ptr);
4037         this_ptr_conv._underlying_ref = false;
4038         return UpdateAddHTLC_free(this_ptr_conv);
4039 }
4040
4041 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4042         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4043         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4044         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_channel_id(this_ptr_conv));
4045         return ret_arr;
4046 }
4047
4048 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4049         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4050         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4051         FREE((void*)val);
4052         return UpdateAddHTLC_set_channel_id(this_ptr_conv, val_conv);
4053 }
4054
4055 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4056         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4057         return UpdateAddHTLC_get_htlc_id(this_ptr_conv);
4058 }
4059
4060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4061         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4062         return UpdateAddHTLC_set_htlc_id(this_ptr_conv, val);
4063 }
4064
4065 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4066         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4067         return UpdateAddHTLC_get_amount_msat(this_ptr_conv);
4068 }
4069
4070 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4071         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4072         return UpdateAddHTLC_set_amount_msat(this_ptr_conv, val);
4073 }
4074
4075 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
4076         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4077         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4078         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateAddHTLC_get_payment_hash(this_ptr_conv));
4079         return ret_arr;
4080 }
4081
4082 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4083         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4084         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4085         FREE((void*)val);
4086         return UpdateAddHTLC_set_payment_hash(this_ptr_conv, val_conv);
4087 }
4088
4089 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
4090         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4091         return UpdateAddHTLC_get_cltv_expiry(this_ptr_conv);
4092 }
4093
4094 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4095         LDKUpdateAddHTLC* this_ptr_conv = (LDKUpdateAddHTLC*)this_ptr;
4096         return UpdateAddHTLC_set_cltv_expiry(this_ptr_conv, val);
4097 }
4098
4099 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4100         LDKUpdateFulfillHTLC this_ptr_conv = *(LDKUpdateFulfillHTLC*)this_ptr;
4101         FREE((void*)this_ptr);
4102         this_ptr_conv._underlying_ref = false;
4103         return UpdateFulfillHTLC_free(this_ptr_conv);
4104 }
4105
4106 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4107         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4108         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4109         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_channel_id(this_ptr_conv));
4110         return ret_arr;
4111 }
4112
4113 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4114         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4115         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4116         FREE((void*)val);
4117         return UpdateFulfillHTLC_set_channel_id(this_ptr_conv, val_conv);
4118 }
4119
4120 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4121         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4122         return UpdateFulfillHTLC_get_htlc_id(this_ptr_conv);
4123 }
4124
4125 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4126         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4127         return UpdateFulfillHTLC_set_htlc_id(this_ptr_conv, val);
4128 }
4129
4130 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1get_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr) {
4131         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4132         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4133         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFulfillHTLC_get_payment_preimage(this_ptr_conv));
4134         return ret_arr;
4135 }
4136
4137 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1set_1payment_1preimage(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4138         LDKUpdateFulfillHTLC* this_ptr_conv = (LDKUpdateFulfillHTLC*)this_ptr;
4139         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4140         FREE((void*)val);
4141         return UpdateFulfillHTLC_set_payment_preimage(this_ptr_conv, val_conv);
4142 }
4143
4144 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong htlc_id_arg, jlong payment_preimage_arg) {
4145         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4146         FREE((void*)channel_id_arg);
4147         LDKThirtyTwoBytes payment_preimage_arg_conv = *(LDKThirtyTwoBytes*)payment_preimage_arg;
4148         FREE((void*)payment_preimage_arg);
4149         LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
4150         *ret = UpdateFulfillHTLC_new(channel_id_arg_conv, htlc_id_arg, payment_preimage_arg_conv);
4151         assert(!ret->_underlying_ref);
4152         ret->_underlying_ref = true;
4153         return (long)ret;
4154 }
4155
4156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4157         LDKUpdateFailHTLC this_ptr_conv = *(LDKUpdateFailHTLC*)this_ptr;
4158         FREE((void*)this_ptr);
4159         this_ptr_conv._underlying_ref = false;
4160         return UpdateFailHTLC_free(this_ptr_conv);
4161 }
4162
4163 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4164         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
4165         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4166         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailHTLC_get_channel_id(this_ptr_conv));
4167         return ret_arr;
4168 }
4169
4170 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4171         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
4172         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4173         FREE((void*)val);
4174         return UpdateFailHTLC_set_channel_id(this_ptr_conv, val_conv);
4175 }
4176
4177 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4178         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
4179         return UpdateFailHTLC_get_htlc_id(this_ptr_conv);
4180 }
4181
4182 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4183         LDKUpdateFailHTLC* this_ptr_conv = (LDKUpdateFailHTLC*)this_ptr;
4184         return UpdateFailHTLC_set_htlc_id(this_ptr_conv, val);
4185 }
4186
4187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4188         LDKUpdateFailMalformedHTLC this_ptr_conv = *(LDKUpdateFailMalformedHTLC*)this_ptr;
4189         FREE((void*)this_ptr);
4190         this_ptr_conv._underlying_ref = false;
4191         return UpdateFailMalformedHTLC_free(this_ptr_conv);
4192 }
4193
4194 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4195         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4196         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4197         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFailMalformedHTLC_get_channel_id(this_ptr_conv));
4198         return ret_arr;
4199 }
4200
4201 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4202         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4203         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4204         FREE((void*)val);
4205         return UpdateFailMalformedHTLC_set_channel_id(this_ptr_conv, val_conv);
4206 }
4207
4208 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4209         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4210         return UpdateFailMalformedHTLC_get_htlc_id(this_ptr_conv);
4211 }
4212
4213 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1htlc_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4214         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4215         return UpdateFailMalformedHTLC_set_htlc_id(this_ptr_conv, val);
4216 }
4217
4218 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
4219         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4220         return UpdateFailMalformedHTLC_get_failure_code(this_ptr_conv);
4221 }
4222
4223 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4224         LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
4225         return UpdateFailMalformedHTLC_set_failure_code(this_ptr_conv, val);
4226 }
4227
4228 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4229         LDKCommitmentSigned this_ptr_conv = *(LDKCommitmentSigned*)this_ptr;
4230         FREE((void*)this_ptr);
4231         this_ptr_conv._underlying_ref = false;
4232         return CommitmentSigned_free(this_ptr_conv);
4233 }
4234
4235 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4236         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
4237         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4238         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *CommitmentSigned_get_channel_id(this_ptr_conv));
4239         return ret_arr;
4240 }
4241
4242 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4243         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
4244         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4245         FREE((void*)val);
4246         return CommitmentSigned_set_channel_id(this_ptr_conv, val_conv);
4247 }
4248
4249 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4250         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
4251         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4252         *ret = CommitmentSigned_get_signature(this_ptr_conv);
4253         return (long)ret;
4254 }
4255
4256 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4257         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
4258         LDKSignature val_conv = *(LDKSignature*)val;
4259         FREE((void*)val);
4260         return CommitmentSigned_set_signature(this_ptr_conv, val_conv);
4261 }
4262
4263 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1set_1htlc_1signatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4264         LDKCommitmentSigned* this_ptr_conv = (LDKCommitmentSigned*)this_ptr;
4265         LDKCVec_SignatureZ val_conv = *(LDKCVec_SignatureZ*)val;
4266         FREE((void*)val);
4267         return CommitmentSigned_set_htlc_signatures(this_ptr_conv, val_conv);
4268 }
4269
4270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong signature_arg, jlong htlc_signatures_arg) {
4271         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4272         FREE((void*)channel_id_arg);
4273         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
4274         FREE((void*)signature_arg);
4275         LDKCVec_SignatureZ htlc_signatures_arg_conv = *(LDKCVec_SignatureZ*)htlc_signatures_arg;
4276         FREE((void*)htlc_signatures_arg);
4277         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
4278         *ret = CommitmentSigned_new(channel_id_arg_conv, signature_arg_conv, htlc_signatures_arg_conv);
4279         assert(!ret->_underlying_ref);
4280         ret->_underlying_ref = true;
4281         return (long)ret;
4282 }
4283
4284 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4285         LDKRevokeAndACK this_ptr_conv = *(LDKRevokeAndACK*)this_ptr;
4286         FREE((void*)this_ptr);
4287         this_ptr_conv._underlying_ref = false;
4288         return RevokeAndACK_free(this_ptr_conv);
4289 }
4290
4291 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4292         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4293         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4294         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_channel_id(this_ptr_conv));
4295         return ret_arr;
4296 }
4297
4298 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4299         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4300         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4301         FREE((void*)val);
4302         return RevokeAndACK_set_channel_id(this_ptr_conv, val_conv);
4303 }
4304
4305 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
4306         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4307         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4308         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *RevokeAndACK_get_per_commitment_secret(this_ptr_conv));
4309         return ret_arr;
4310 }
4311
4312 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4313         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4314         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4315         FREE((void*)val);
4316         return RevokeAndACK_set_per_commitment_secret(this_ptr_conv, val_conv);
4317 }
4318
4319 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1get_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
4320         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4321         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4322         *ret = RevokeAndACK_get_next_per_commitment_point(this_ptr_conv);
4323         return (long)ret;
4324 }
4325
4326 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1set_1next_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4327         LDKRevokeAndACK* this_ptr_conv = (LDKRevokeAndACK*)this_ptr;
4328         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4329         FREE((void*)val);
4330         return RevokeAndACK_set_next_per_commitment_point(this_ptr_conv, val_conv);
4331 }
4332
4333 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong per_commitment_secret_arg, jlong next_per_commitment_point_arg) {
4334         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4335         FREE((void*)channel_id_arg);
4336         LDKThirtyTwoBytes per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)per_commitment_secret_arg;
4337         FREE((void*)per_commitment_secret_arg);
4338         LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
4339         FREE((void*)next_per_commitment_point_arg);
4340         LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
4341         *ret = RevokeAndACK_new(channel_id_arg_conv, per_commitment_secret_arg_conv, next_per_commitment_point_arg_conv);
4342         assert(!ret->_underlying_ref);
4343         ret->_underlying_ref = true;
4344         return (long)ret;
4345 }
4346
4347 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4348         LDKUpdateFee this_ptr_conv = *(LDKUpdateFee*)this_ptr;
4349         FREE((void*)this_ptr);
4350         this_ptr_conv._underlying_ref = false;
4351         return UpdateFee_free(this_ptr_conv);
4352 }
4353
4354 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4355         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
4356         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4357         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UpdateFee_get_channel_id(this_ptr_conv));
4358         return ret_arr;
4359 }
4360
4361 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4362         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
4363         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4364         FREE((void*)val);
4365         return UpdateFee_set_channel_id(this_ptr_conv, val_conv);
4366 }
4367
4368 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UpdateFee_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
4369         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
4370         return UpdateFee_get_feerate_per_kw(this_ptr_conv);
4371 }
4372
4373 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFee_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4374         LDKUpdateFee* this_ptr_conv = (LDKUpdateFee*)this_ptr;
4375         return UpdateFee_set_feerate_per_kw(this_ptr_conv, val);
4376 }
4377
4378 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jint feerate_per_kw_arg) {
4379         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4380         FREE((void*)channel_id_arg);
4381         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
4382         *ret = UpdateFee_new(channel_id_arg_conv, feerate_per_kw_arg);
4383         assert(!ret->_underlying_ref);
4384         ret->_underlying_ref = true;
4385         return (long)ret;
4386 }
4387
4388 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4389         LDKDataLossProtect this_ptr_conv = *(LDKDataLossProtect*)this_ptr;
4390         FREE((void*)this_ptr);
4391         this_ptr_conv._underlying_ref = false;
4392         return DataLossProtect_free(this_ptr_conv);
4393 }
4394
4395 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr) {
4396         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
4397         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4398         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *DataLossProtect_get_your_last_per_commitment_secret(this_ptr_conv));
4399         return ret_arr;
4400 }
4401
4402 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1your_1last_1per_1commitment_1secret(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4403         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
4404         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4405         FREE((void*)val);
4406         return DataLossProtect_set_your_last_per_commitment_secret(this_ptr_conv, val_conv);
4407 }
4408
4409 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1get_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
4410         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
4411         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4412         *ret = DataLossProtect_get_my_current_per_commitment_point(this_ptr_conv);
4413         return (long)ret;
4414 }
4415
4416 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1set_1my_1current_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4417         LDKDataLossProtect* this_ptr_conv = (LDKDataLossProtect*)this_ptr;
4418         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4419         FREE((void*)val);
4420         return DataLossProtect_set_my_current_per_commitment_point(this_ptr_conv, val_conv);
4421 }
4422
4423 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DataLossProtect_1new(JNIEnv * _env, jclass _b, jlong your_last_per_commitment_secret_arg, jlong my_current_per_commitment_point_arg) {
4424         LDKThirtyTwoBytes your_last_per_commitment_secret_arg_conv = *(LDKThirtyTwoBytes*)your_last_per_commitment_secret_arg;
4425         FREE((void*)your_last_per_commitment_secret_arg);
4426         LDKPublicKey my_current_per_commitment_point_arg_conv = *(LDKPublicKey*)my_current_per_commitment_point_arg;
4427         FREE((void*)my_current_per_commitment_point_arg);
4428         LDKDataLossProtect* ret = MALLOC(sizeof(LDKDataLossProtect), "LDKDataLossProtect");
4429         *ret = DataLossProtect_new(your_last_per_commitment_secret_arg_conv, my_current_per_commitment_point_arg_conv);
4430         assert(!ret->_underlying_ref);
4431         ret->_underlying_ref = true;
4432         return (long)ret;
4433 }
4434
4435 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4436         LDKChannelReestablish this_ptr_conv = *(LDKChannelReestablish*)this_ptr;
4437         FREE((void*)this_ptr);
4438         this_ptr_conv._underlying_ref = false;
4439         return ChannelReestablish_free(this_ptr_conv);
4440 }
4441
4442 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4443         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4444         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4445         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelReestablish_get_channel_id(this_ptr_conv));
4446         return ret_arr;
4447 }
4448
4449 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4450         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4451         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4452         FREE((void*)val);
4453         return ChannelReestablish_set_channel_id(this_ptr_conv, val_conv);
4454 }
4455
4456 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
4457         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4458         return ChannelReestablish_get_next_local_commitment_number(this_ptr_conv);
4459 }
4460
4461 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1local_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4462         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4463         return ChannelReestablish_set_next_local_commitment_number(this_ptr_conv, val);
4464 }
4465
4466 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1get_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr) {
4467         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4468         return ChannelReestablish_get_next_remote_commitment_number(this_ptr_conv);
4469 }
4470
4471 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1set_1next_1remote_1commitment_1number(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4472         LDKChannelReestablish* this_ptr_conv = (LDKChannelReestablish*)this_ptr;
4473         return ChannelReestablish_set_next_remote_commitment_number(this_ptr_conv, val);
4474 }
4475
4476 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4477         LDKAnnouncementSignatures this_ptr_conv = *(LDKAnnouncementSignatures*)this_ptr;
4478         FREE((void*)this_ptr);
4479         this_ptr_conv._underlying_ref = false;
4480         return AnnouncementSignatures_free(this_ptr_conv);
4481 }
4482
4483 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4484         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4485         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4486         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *AnnouncementSignatures_get_channel_id(this_ptr_conv));
4487         return ret_arr;
4488 }
4489
4490 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4491         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4492         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4493         FREE((void*)val);
4494         return AnnouncementSignatures_set_channel_id(this_ptr_conv, val_conv);
4495 }
4496
4497 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4498         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4499         return AnnouncementSignatures_get_short_channel_id(this_ptr_conv);
4500 }
4501
4502 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4503         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4504         return AnnouncementSignatures_set_short_channel_id(this_ptr_conv, val);
4505 }
4506
4507 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4508         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4509         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4510         *ret = AnnouncementSignatures_get_node_signature(this_ptr_conv);
4511         return (long)ret;
4512 }
4513
4514 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1node_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4515         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4516         LDKSignature val_conv = *(LDKSignature*)val;
4517         FREE((void*)val);
4518         return AnnouncementSignatures_set_node_signature(this_ptr_conv, val_conv);
4519 }
4520
4521 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1get_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4522         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4523         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4524         *ret = AnnouncementSignatures_get_bitcoin_signature(this_ptr_conv);
4525         return (long)ret;
4526 }
4527
4528 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1set_1bitcoin_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4529         LDKAnnouncementSignatures* this_ptr_conv = (LDKAnnouncementSignatures*)this_ptr;
4530         LDKSignature val_conv = *(LDKSignature*)val;
4531         FREE((void*)val);
4532         return AnnouncementSignatures_set_bitcoin_signature(this_ptr_conv, val_conv);
4533 }
4534
4535 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1new(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong short_channel_id_arg, jlong node_signature_arg, jlong bitcoin_signature_arg) {
4536         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
4537         FREE((void*)channel_id_arg);
4538         LDKSignature node_signature_arg_conv = *(LDKSignature*)node_signature_arg;
4539         FREE((void*)node_signature_arg);
4540         LDKSignature bitcoin_signature_arg_conv = *(LDKSignature*)bitcoin_signature_arg;
4541         FREE((void*)bitcoin_signature_arg);
4542         LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
4543         *ret = AnnouncementSignatures_new(channel_id_arg_conv, short_channel_id_arg, node_signature_arg_conv, bitcoin_signature_arg_conv);
4544         assert(!ret->_underlying_ref);
4545         ret->_underlying_ref = true;
4546         return (long)ret;
4547 }
4548
4549 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetAddress_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4550         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
4551         FREE((void*)this_ptr);
4552         return NetAddress_free(this_ptr_conv);
4553 }
4554
4555 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4556         LDKUnsignedNodeAnnouncement this_ptr_conv = *(LDKUnsignedNodeAnnouncement*)this_ptr;
4557         FREE((void*)this_ptr);
4558         this_ptr_conv._underlying_ref = false;
4559         return UnsignedNodeAnnouncement_free(this_ptr_conv);
4560 }
4561
4562 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
4563         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4564         return UnsignedNodeAnnouncement_get_timestamp(this_ptr_conv);
4565 }
4566
4567 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4568         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4569         return UnsignedNodeAnnouncement_set_timestamp(this_ptr_conv, val);
4570 }
4571
4572 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4573         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4574         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4575         *ret = UnsignedNodeAnnouncement_get_node_id(this_ptr_conv);
4576         return (long)ret;
4577 }
4578
4579 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4580         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4581         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4582         FREE((void*)val);
4583         return UnsignedNodeAnnouncement_set_node_id(this_ptr_conv, val_conv);
4584 }
4585
4586 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
4587         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4588         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
4589         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *UnsignedNodeAnnouncement_get_rgb(this_ptr_conv));
4590         return ret_arr;
4591 }
4592
4593 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4594         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4595         LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
4596         FREE((void*)val);
4597         return UnsignedNodeAnnouncement_set_rgb(this_ptr_conv, val_conv);
4598 }
4599
4600 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
4601         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4602         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4603         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedNodeAnnouncement_get_alias(this_ptr_conv));
4604         return ret_arr;
4605 }
4606
4607 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4608         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4609         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4610         FREE((void*)val);
4611         return UnsignedNodeAnnouncement_set_alias(this_ptr_conv, val_conv);
4612 }
4613
4614 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4615         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
4616         LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
4617         FREE((void*)val);
4618         return UnsignedNodeAnnouncement_set_addresses(this_ptr_conv, val_conv);
4619 }
4620
4621 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4622         LDKNodeAnnouncement this_ptr_conv = *(LDKNodeAnnouncement*)this_ptr;
4623         FREE((void*)this_ptr);
4624         this_ptr_conv._underlying_ref = false;
4625         return NodeAnnouncement_free(this_ptr_conv);
4626 }
4627
4628 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4629         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
4630         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4631         *ret = NodeAnnouncement_get_signature(this_ptr_conv);
4632         return (long)ret;
4633 }
4634
4635 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4636         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
4637         LDKSignature val_conv = *(LDKSignature*)val;
4638         FREE((void*)val);
4639         return NodeAnnouncement_set_signature(this_ptr_conv, val_conv);
4640 }
4641
4642 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
4643         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
4644         LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
4645         *ret = NodeAnnouncement_get_contents(this_ptr_conv);
4646         assert(!ret->_underlying_ref);
4647         ret->_underlying_ref = true;
4648         return (long)ret;
4649 }
4650
4651 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4652         LDKNodeAnnouncement* this_ptr_conv = (LDKNodeAnnouncement*)this_ptr;
4653         LDKUnsignedNodeAnnouncement val_conv = *(LDKUnsignedNodeAnnouncement*)val;
4654         FREE((void*)val);
4655         val_conv._underlying_ref = false;
4656         return NodeAnnouncement_set_contents(this_ptr_conv, val_conv);
4657 }
4658
4659 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
4660         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
4661         FREE((void*)signature_arg);
4662         LDKUnsignedNodeAnnouncement contents_arg_conv = *(LDKUnsignedNodeAnnouncement*)contents_arg;
4663         FREE((void*)contents_arg);
4664         contents_arg_conv._underlying_ref = false;
4665         LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
4666         *ret = NodeAnnouncement_new(signature_arg_conv, contents_arg_conv);
4667         assert(!ret->_underlying_ref);
4668         ret->_underlying_ref = true;
4669         return (long)ret;
4670 }
4671
4672 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4673         LDKUnsignedChannelAnnouncement this_ptr_conv = *(LDKUnsignedChannelAnnouncement*)this_ptr;
4674         FREE((void*)this_ptr);
4675         this_ptr_conv._underlying_ref = false;
4676         return UnsignedChannelAnnouncement_free(this_ptr_conv);
4677 }
4678
4679 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
4680         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4681         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4682         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelAnnouncement_get_chain_hash(this_ptr_conv));
4683         return ret_arr;
4684 }
4685
4686 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4687         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4688         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4689         FREE((void*)val);
4690         return UnsignedChannelAnnouncement_set_chain_hash(this_ptr_conv, val_conv);
4691 }
4692
4693 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4694         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4695         return UnsignedChannelAnnouncement_get_short_channel_id(this_ptr_conv);
4696 }
4697
4698 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4699         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4700         return UnsignedChannelAnnouncement_set_short_channel_id(this_ptr_conv, val);
4701 }
4702
4703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
4704         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4705         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4706         *ret = UnsignedChannelAnnouncement_get_node_id_1(this_ptr_conv);
4707         return (long)ret;
4708 }
4709
4710 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4711         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4712         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4713         FREE((void*)val);
4714         return UnsignedChannelAnnouncement_set_node_id_1(this_ptr_conv, val_conv);
4715 }
4716
4717 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
4718         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4719         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4720         *ret = UnsignedChannelAnnouncement_get_node_id_2(this_ptr_conv);
4721         return (long)ret;
4722 }
4723
4724 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1node_1id_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4725         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4726         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4727         FREE((void*)val);
4728         return UnsignedChannelAnnouncement_set_node_id_2(this_ptr_conv, val_conv);
4729 }
4730
4731 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
4732         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4733         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4734         *ret = UnsignedChannelAnnouncement_get_bitcoin_key_1(this_ptr_conv);
4735         return (long)ret;
4736 }
4737
4738 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4739         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4740         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4741         FREE((void*)val);
4742         return UnsignedChannelAnnouncement_set_bitcoin_key_1(this_ptr_conv, val_conv);
4743 }
4744
4745 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1get_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
4746         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4747         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
4748         *ret = UnsignedChannelAnnouncement_get_bitcoin_key_2(this_ptr_conv);
4749         return (long)ret;
4750 }
4751
4752 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1set_1bitcoin_1key_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4753         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
4754         LDKPublicKey val_conv = *(LDKPublicKey*)val;
4755         FREE((void*)val);
4756         return UnsignedChannelAnnouncement_set_bitcoin_key_2(this_ptr_conv, val_conv);
4757 }
4758
4759 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4760         LDKChannelAnnouncement this_ptr_conv = *(LDKChannelAnnouncement*)this_ptr;
4761         FREE((void*)this_ptr);
4762         this_ptr_conv._underlying_ref = false;
4763         return ChannelAnnouncement_free(this_ptr_conv);
4764 }
4765
4766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
4767         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4768         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4769         *ret = ChannelAnnouncement_get_node_signature_1(this_ptr_conv);
4770         return (long)ret;
4771 }
4772
4773 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4774         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4775         LDKSignature val_conv = *(LDKSignature*)val;
4776         FREE((void*)val);
4777         return ChannelAnnouncement_set_node_signature_1(this_ptr_conv, val_conv);
4778 }
4779
4780 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
4781         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4782         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4783         *ret = ChannelAnnouncement_get_node_signature_2(this_ptr_conv);
4784         return (long)ret;
4785 }
4786
4787 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1node_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4788         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4789         LDKSignature val_conv = *(LDKSignature*)val;
4790         FREE((void*)val);
4791         return ChannelAnnouncement_set_node_signature_2(this_ptr_conv, val_conv);
4792 }
4793
4794 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr) {
4795         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4796         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4797         *ret = ChannelAnnouncement_get_bitcoin_signature_1(this_ptr_conv);
4798         return (long)ret;
4799 }
4800
4801 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_11(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4802         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4803         LDKSignature val_conv = *(LDKSignature*)val;
4804         FREE((void*)val);
4805         return ChannelAnnouncement_set_bitcoin_signature_1(this_ptr_conv, val_conv);
4806 }
4807
4808 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr) {
4809         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4810         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4811         *ret = ChannelAnnouncement_get_bitcoin_signature_2(this_ptr_conv);
4812         return (long)ret;
4813 }
4814
4815 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1bitcoin_1signature_12(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4816         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4817         LDKSignature val_conv = *(LDKSignature*)val;
4818         FREE((void*)val);
4819         return ChannelAnnouncement_set_bitcoin_signature_2(this_ptr_conv, val_conv);
4820 }
4821
4822 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
4823         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4824         LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
4825         *ret = ChannelAnnouncement_get_contents(this_ptr_conv);
4826         assert(!ret->_underlying_ref);
4827         ret->_underlying_ref = true;
4828         return (long)ret;
4829 }
4830
4831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4832         LDKChannelAnnouncement* this_ptr_conv = (LDKChannelAnnouncement*)this_ptr;
4833         LDKUnsignedChannelAnnouncement val_conv = *(LDKUnsignedChannelAnnouncement*)val;
4834         FREE((void*)val);
4835         val_conv._underlying_ref = false;
4836         return ChannelAnnouncement_set_contents(this_ptr_conv, val_conv);
4837 }
4838
4839 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1new(JNIEnv * _env, jclass _b, jlong node_signature_1_arg, jlong node_signature_2_arg, jlong bitcoin_signature_1_arg, jlong bitcoin_signature_2_arg, jlong contents_arg) {
4840         LDKSignature node_signature_1_arg_conv = *(LDKSignature*)node_signature_1_arg;
4841         FREE((void*)node_signature_1_arg);
4842         LDKSignature node_signature_2_arg_conv = *(LDKSignature*)node_signature_2_arg;
4843         FREE((void*)node_signature_2_arg);
4844         LDKSignature bitcoin_signature_1_arg_conv = *(LDKSignature*)bitcoin_signature_1_arg;
4845         FREE((void*)bitcoin_signature_1_arg);
4846         LDKSignature bitcoin_signature_2_arg_conv = *(LDKSignature*)bitcoin_signature_2_arg;
4847         FREE((void*)bitcoin_signature_2_arg);
4848         LDKUnsignedChannelAnnouncement contents_arg_conv = *(LDKUnsignedChannelAnnouncement*)contents_arg;
4849         FREE((void*)contents_arg);
4850         contents_arg_conv._underlying_ref = false;
4851         LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
4852         *ret = ChannelAnnouncement_new(node_signature_1_arg_conv, node_signature_2_arg_conv, bitcoin_signature_1_arg_conv, bitcoin_signature_2_arg_conv, contents_arg_conv);
4853         assert(!ret->_underlying_ref);
4854         ret->_underlying_ref = true;
4855         return (long)ret;
4856 }
4857
4858 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4859         LDKUnsignedChannelUpdate this_ptr_conv = *(LDKUnsignedChannelUpdate*)this_ptr;
4860         FREE((void*)this_ptr);
4861         this_ptr_conv._underlying_ref = false;
4862         return UnsignedChannelUpdate_free(this_ptr_conv);
4863 }
4864
4865 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
4866         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4867         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
4868         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *UnsignedChannelUpdate_get_chain_hash(this_ptr_conv));
4869         return ret_arr;
4870 }
4871
4872 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1chain_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4873         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4874         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
4875         FREE((void*)val);
4876         return UnsignedChannelUpdate_set_chain_hash(this_ptr_conv, val_conv);
4877 }
4878
4879 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
4880         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4881         return UnsignedChannelUpdate_get_short_channel_id(this_ptr_conv);
4882 }
4883
4884 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4885         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4886         return UnsignedChannelUpdate_set_short_channel_id(this_ptr_conv, val);
4887 }
4888
4889 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr) {
4890         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4891         return UnsignedChannelUpdate_get_timestamp(this_ptr_conv);
4892 }
4893
4894 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1timestamp(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4895         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4896         return UnsignedChannelUpdate_set_timestamp(this_ptr_conv, val);
4897 }
4898
4899 JNIEXPORT jbyte JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1flags(JNIEnv * _env, jclass _b, jlong this_ptr) {
4900         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4901         return UnsignedChannelUpdate_get_flags(this_ptr_conv);
4902 }
4903
4904 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1flags(JNIEnv * _env, jclass _b, jlong this_ptr, jbyte val) {
4905         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4906         return UnsignedChannelUpdate_set_flags(this_ptr_conv, val);
4907 }
4908
4909 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
4910         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4911         return UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr_conv);
4912 }
4913
4914 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
4915         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4916         return UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr_conv, val);
4917 }
4918
4919 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4920         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4921         return UnsignedChannelUpdate_get_htlc_minimum_msat(this_ptr_conv);
4922 }
4923
4924 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4925         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4926         return UnsignedChannelUpdate_set_htlc_minimum_msat(this_ptr_conv, val);
4927 }
4928
4929 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
4930         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4931         return UnsignedChannelUpdate_get_fee_base_msat(this_ptr_conv);
4932 }
4933
4934 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4935         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4936         return UnsignedChannelUpdate_set_fee_base_msat(this_ptr_conv, val);
4937 }
4938
4939 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
4940         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4941         return UnsignedChannelUpdate_get_fee_proportional_millionths(this_ptr_conv);
4942 }
4943
4944 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fee_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
4945         LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
4946         return UnsignedChannelUpdate_set_fee_proportional_millionths(this_ptr_conv, val);
4947 }
4948
4949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
4950         LDKChannelUpdate this_ptr_conv = *(LDKChannelUpdate*)this_ptr;
4951         FREE((void*)this_ptr);
4952         this_ptr_conv._underlying_ref = false;
4953         return ChannelUpdate_free(this_ptr_conv);
4954 }
4955
4956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
4957         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
4958         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
4959         *ret = ChannelUpdate_get_signature(this_ptr_conv);
4960         return (long)ret;
4961 }
4962
4963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1signature(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4964         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
4965         LDKSignature val_conv = *(LDKSignature*)val;
4966         FREE((void*)val);
4967         return ChannelUpdate_set_signature(this_ptr_conv, val_conv);
4968 }
4969
4970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1get_1contents(JNIEnv * _env, jclass _b, jlong this_ptr) {
4971         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
4972         LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
4973         *ret = ChannelUpdate_get_contents(this_ptr_conv);
4974         assert(!ret->_underlying_ref);
4975         ret->_underlying_ref = true;
4976         return (long)ret;
4977 }
4978
4979 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1set_1contents(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
4980         LDKChannelUpdate* this_ptr_conv = (LDKChannelUpdate*)this_ptr;
4981         LDKUnsignedChannelUpdate val_conv = *(LDKUnsignedChannelUpdate*)val;
4982         FREE((void*)val);
4983         val_conv._underlying_ref = false;
4984         return ChannelUpdate_set_contents(this_ptr_conv, val_conv);
4985 }
4986
4987 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1new(JNIEnv * _env, jclass _b, jlong signature_arg, jlong contents_arg) {
4988         LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
4989         FREE((void*)signature_arg);
4990         LDKUnsignedChannelUpdate contents_arg_conv = *(LDKUnsignedChannelUpdate*)contents_arg;
4991         FREE((void*)contents_arg);
4992         contents_arg_conv._underlying_ref = false;
4993         LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
4994         *ret = ChannelUpdate_new(signature_arg_conv, contents_arg_conv);
4995         assert(!ret->_underlying_ref);
4996         ret->_underlying_ref = true;
4997         return (long)ret;
4998 }
4999
5000 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ErrorAction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5001         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
5002         FREE((void*)this_ptr);
5003         return ErrorAction_free(this_ptr_conv);
5004 }
5005
5006 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5007         LDKLightningError this_ptr_conv = *(LDKLightningError*)this_ptr;
5008         FREE((void*)this_ptr);
5009         this_ptr_conv._underlying_ref = false;
5010         return LightningError_free(this_ptr_conv);
5011 }
5012
5013 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1err(JNIEnv * _env, jclass _b, jlong this_ptr) {
5014         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
5015         LDKStr* ret = MALLOC(sizeof(LDKStr), "LDKStr");
5016         *ret = LightningError_get_err(this_ptr_conv);
5017         return (long)ret;
5018 }
5019
5020 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1err(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5021         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
5022         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
5023         FREE((void*)val);
5024         return LightningError_set_err(this_ptr_conv, val_conv);
5025 }
5026
5027 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1get_1action(JNIEnv * _env, jclass _b, jlong this_ptr) {
5028         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
5029         LDKErrorAction* ret = MALLOC(sizeof(LDKErrorAction), "LDKErrorAction");
5030         *ret = LightningError_get_action(this_ptr_conv);
5031         return (long)ret;
5032 }
5033
5034 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LightningError_1set_1action(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5035         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
5036         LDKErrorAction val_conv = *(LDKErrorAction*)val;
5037         FREE((void*)val);
5038         return LightningError_set_action(this_ptr_conv, val_conv);
5039 }
5040
5041 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LightningError_1new(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
5042         LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
5043         FREE((void*)err_arg);
5044         LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
5045         FREE((void*)action_arg);
5046         LDKLightningError* ret = MALLOC(sizeof(LDKLightningError), "LDKLightningError");
5047         *ret = LightningError_new(err_arg_conv, action_arg_conv);
5048         assert(!ret->_underlying_ref);
5049         ret->_underlying_ref = true;
5050         return (long)ret;
5051 }
5052
5053 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5054         LDKCommitmentUpdate this_ptr_conv = *(LDKCommitmentUpdate*)this_ptr;
5055         FREE((void*)this_ptr);
5056         this_ptr_conv._underlying_ref = false;
5057         return CommitmentUpdate_free(this_ptr_conv);
5058 }
5059
5060 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1add_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5061         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5062         LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
5063         FREE((void*)val);
5064         return CommitmentUpdate_set_update_add_htlcs(this_ptr_conv, val_conv);
5065 }
5066
5067 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fulfill_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5068         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5069         LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
5070         FREE((void*)val);
5071         return CommitmentUpdate_set_update_fulfill_htlcs(this_ptr_conv, val_conv);
5072 }
5073
5074 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5075         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5076         LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
5077         FREE((void*)val);
5078         return CommitmentUpdate_set_update_fail_htlcs(this_ptr_conv, val_conv);
5079 }
5080
5081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fail_1malformed_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5082         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5083         LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
5084         FREE((void*)val);
5085         return CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr_conv, val_conv);
5086 }
5087
5088 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr) {
5089         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5090         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
5091         *ret = CommitmentUpdate_get_update_fee(this_ptr_conv);
5092         assert(!ret->_underlying_ref);
5093         ret->_underlying_ref = true;
5094         return (long)ret;
5095 }
5096
5097 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1update_1fee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5098         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5099         LDKUpdateFee val_conv = *(LDKUpdateFee*)val;
5100         FREE((void*)val);
5101         val_conv._underlying_ref = false;
5102         return CommitmentUpdate_set_update_fee(this_ptr_conv, val_conv);
5103 }
5104
5105 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1get_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr) {
5106         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5107         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
5108         *ret = CommitmentUpdate_get_commitment_signed(this_ptr_conv);
5109         assert(!ret->_underlying_ref);
5110         ret->_underlying_ref = true;
5111         return (long)ret;
5112 }
5113
5114 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1set_1commitment_1signed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5115         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
5116         LDKCommitmentSigned val_conv = *(LDKCommitmentSigned*)val;
5117         FREE((void*)val);
5118         val_conv._underlying_ref = false;
5119         return CommitmentUpdate_set_commitment_signed(this_ptr_conv, val_conv);
5120 }
5121
5122 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentUpdate_1new(JNIEnv * _env, jclass _b, jlong update_add_htlcs_arg, jlong update_fulfill_htlcs_arg, jlong update_fail_htlcs_arg, jlong update_fail_malformed_htlcs_arg, jlong update_fee_arg, jlong commitment_signed_arg) {
5123         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
5124         FREE((void*)update_add_htlcs_arg);
5125         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
5126         FREE((void*)update_fulfill_htlcs_arg);
5127         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
5128         FREE((void*)update_fail_htlcs_arg);
5129         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
5130         FREE((void*)update_fail_malformed_htlcs_arg);
5131         LDKUpdateFee update_fee_arg_conv = *(LDKUpdateFee*)update_fee_arg;
5132         FREE((void*)update_fee_arg);
5133         update_fee_arg_conv._underlying_ref = false;
5134         LDKCommitmentSigned commitment_signed_arg_conv = *(LDKCommitmentSigned*)commitment_signed_arg;
5135         FREE((void*)commitment_signed_arg);
5136         commitment_signed_arg_conv._underlying_ref = false;
5137         LDKCommitmentUpdate* ret = MALLOC(sizeof(LDKCommitmentUpdate), "LDKCommitmentUpdate");
5138         *ret = CommitmentUpdate_new(update_add_htlcs_arg_conv, update_fulfill_htlcs_arg_conv, update_fail_htlcs_arg_conv, update_fail_malformed_htlcs_arg_conv, update_fee_arg_conv, commitment_signed_arg_conv);
5139         assert(!ret->_underlying_ref);
5140         ret->_underlying_ref = true;
5141         return (long)ret;
5142 }
5143
5144 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCFailChannelUpdate_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5145         LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
5146         FREE((void*)this_ptr);
5147         return HTLCFailChannelUpdate_free(this_ptr_conv);
5148 }
5149
5150 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5151         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
5152         FREE((void*)this_ptr);
5153         return ChannelMessageHandler_free(this_ptr_conv);
5154 }
5155
5156 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingMessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5157         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
5158         FREE((void*)this_ptr);
5159         return RoutingMessageHandler_free(this_ptr_conv);
5160 }
5161
5162 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
5163         LDKAcceptChannel* obj_conv = (LDKAcceptChannel*)obj;
5164         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5165         *ret = AcceptChannel_write(obj_conv);
5166         return (long)ret;
5167 }
5168
5169 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
5170         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5171         FREE((void*)ser);
5172         LDKAcceptChannel* ret = MALLOC(sizeof(LDKAcceptChannel), "LDKAcceptChannel");
5173         *ret = AcceptChannel_read(ser_conv);
5174         assert(!ret->_underlying_ref);
5175         ret->_underlying_ref = true;
5176         return (long)ret;
5177 }
5178
5179 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1write(JNIEnv * _env, jclass _b, jlong obj) {
5180         LDKAnnouncementSignatures* obj_conv = (LDKAnnouncementSignatures*)obj;
5181         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5182         *ret = AnnouncementSignatures_write(obj_conv);
5183         return (long)ret;
5184 }
5185
5186 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AnnouncementSignatures_1read(JNIEnv * _env, jclass _b, jlong ser) {
5187         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5188         FREE((void*)ser);
5189         LDKAnnouncementSignatures* ret = MALLOC(sizeof(LDKAnnouncementSignatures), "LDKAnnouncementSignatures");
5190         *ret = AnnouncementSignatures_read(ser_conv);
5191         assert(!ret->_underlying_ref);
5192         ret->_underlying_ref = true;
5193         return (long)ret;
5194 }
5195
5196 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1write(JNIEnv * _env, jclass _b, jlong obj) {
5197         LDKChannelReestablish* obj_conv = (LDKChannelReestablish*)obj;
5198         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5199         *ret = ChannelReestablish_write(obj_conv);
5200         return (long)ret;
5201 }
5202
5203 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelReestablish_1read(JNIEnv * _env, jclass _b, jlong ser) {
5204         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5205         FREE((void*)ser);
5206         LDKChannelReestablish* ret = MALLOC(sizeof(LDKChannelReestablish), "LDKChannelReestablish");
5207         *ret = ChannelReestablish_read(ser_conv);
5208         assert(!ret->_underlying_ref);
5209         ret->_underlying_ref = true;
5210         return (long)ret;
5211 }
5212
5213 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
5214         LDKClosingSigned* obj_conv = (LDKClosingSigned*)obj;
5215         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5216         *ret = ClosingSigned_write(obj_conv);
5217         return (long)ret;
5218 }
5219
5220 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ClosingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
5221         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5222         FREE((void*)ser);
5223         LDKClosingSigned* ret = MALLOC(sizeof(LDKClosingSigned), "LDKClosingSigned");
5224         *ret = ClosingSigned_read(ser_conv);
5225         assert(!ret->_underlying_ref);
5226         ret->_underlying_ref = true;
5227         return (long)ret;
5228 }
5229
5230 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
5231         LDKCommitmentSigned* obj_conv = (LDKCommitmentSigned*)obj;
5232         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5233         *ret = CommitmentSigned_write(obj_conv);
5234         return (long)ret;
5235 }
5236
5237 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
5238         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5239         FREE((void*)ser);
5240         LDKCommitmentSigned* ret = MALLOC(sizeof(LDKCommitmentSigned), "LDKCommitmentSigned");
5241         *ret = CommitmentSigned_read(ser_conv);
5242         assert(!ret->_underlying_ref);
5243         ret->_underlying_ref = true;
5244         return (long)ret;
5245 }
5246
5247 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1write(JNIEnv * _env, jclass _b, jlong obj) {
5248         LDKFundingCreated* obj_conv = (LDKFundingCreated*)obj;
5249         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5250         *ret = FundingCreated_write(obj_conv);
5251         return (long)ret;
5252 }
5253
5254 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1read(JNIEnv * _env, jclass _b, jlong ser) {
5255         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5256         FREE((void*)ser);
5257         LDKFundingCreated* ret = MALLOC(sizeof(LDKFundingCreated), "LDKFundingCreated");
5258         *ret = FundingCreated_read(ser_conv);
5259         assert(!ret->_underlying_ref);
5260         ret->_underlying_ref = true;
5261         return (long)ret;
5262 }
5263
5264 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1write(JNIEnv * _env, jclass _b, jlong obj) {
5265         LDKFundingSigned* obj_conv = (LDKFundingSigned*)obj;
5266         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5267         *ret = FundingSigned_write(obj_conv);
5268         return (long)ret;
5269 }
5270
5271 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingSigned_1read(JNIEnv * _env, jclass _b, jlong ser) {
5272         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5273         FREE((void*)ser);
5274         LDKFundingSigned* ret = MALLOC(sizeof(LDKFundingSigned), "LDKFundingSigned");
5275         *ret = FundingSigned_read(ser_conv);
5276         assert(!ret->_underlying_ref);
5277         ret->_underlying_ref = true;
5278         return (long)ret;
5279 }
5280
5281 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1write(JNIEnv * _env, jclass _b, jlong obj) {
5282         LDKFundingLocked* obj_conv = (LDKFundingLocked*)obj;
5283         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5284         *ret = FundingLocked_write(obj_conv);
5285         return (long)ret;
5286 }
5287
5288 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingLocked_1read(JNIEnv * _env, jclass _b, jlong ser) {
5289         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5290         FREE((void*)ser);
5291         LDKFundingLocked* ret = MALLOC(sizeof(LDKFundingLocked), "LDKFundingLocked");
5292         *ret = FundingLocked_read(ser_conv);
5293         assert(!ret->_underlying_ref);
5294         ret->_underlying_ref = true;
5295         return (long)ret;
5296 }
5297
5298 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1write(JNIEnv * _env, jclass _b, jlong obj) {
5299         LDKInit* obj_conv = (LDKInit*)obj;
5300         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5301         *ret = Init_write(obj_conv);
5302         return (long)ret;
5303 }
5304
5305 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Init_1read(JNIEnv * _env, jclass _b, jlong ser) {
5306         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5307         FREE((void*)ser);
5308         LDKInit* ret = MALLOC(sizeof(LDKInit), "LDKInit");
5309         *ret = Init_read(ser_conv);
5310         assert(!ret->_underlying_ref);
5311         ret->_underlying_ref = true;
5312         return (long)ret;
5313 }
5314
5315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1write(JNIEnv * _env, jclass _b, jlong obj) {
5316         LDKOpenChannel* obj_conv = (LDKOpenChannel*)obj;
5317         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5318         *ret = OpenChannel_write(obj_conv);
5319         return (long)ret;
5320 }
5321
5322 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1read(JNIEnv * _env, jclass _b, jlong ser) {
5323         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5324         FREE((void*)ser);
5325         LDKOpenChannel* ret = MALLOC(sizeof(LDKOpenChannel), "LDKOpenChannel");
5326         *ret = OpenChannel_read(ser_conv);
5327         assert(!ret->_underlying_ref);
5328         ret->_underlying_ref = true;
5329         return (long)ret;
5330 }
5331
5332 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1write(JNIEnv * _env, jclass _b, jlong obj) {
5333         LDKRevokeAndACK* obj_conv = (LDKRevokeAndACK*)obj;
5334         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5335         *ret = RevokeAndACK_write(obj_conv);
5336         return (long)ret;
5337 }
5338
5339 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RevokeAndACK_1read(JNIEnv * _env, jclass _b, jlong ser) {
5340         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5341         FREE((void*)ser);
5342         LDKRevokeAndACK* ret = MALLOC(sizeof(LDKRevokeAndACK), "LDKRevokeAndACK");
5343         *ret = RevokeAndACK_read(ser_conv);
5344         assert(!ret->_underlying_ref);
5345         ret->_underlying_ref = true;
5346         return (long)ret;
5347 }
5348
5349 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1write(JNIEnv * _env, jclass _b, jlong obj) {
5350         LDKShutdown* obj_conv = (LDKShutdown*)obj;
5351         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5352         *ret = Shutdown_write(obj_conv);
5353         return (long)ret;
5354 }
5355
5356 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Shutdown_1read(JNIEnv * _env, jclass _b, jlong ser) {
5357         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5358         FREE((void*)ser);
5359         LDKShutdown* ret = MALLOC(sizeof(LDKShutdown), "LDKShutdown");
5360         *ret = Shutdown_read(ser_conv);
5361         assert(!ret->_underlying_ref);
5362         ret->_underlying_ref = true;
5363         return (long)ret;
5364 }
5365
5366 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
5367         LDKUpdateFailHTLC* obj_conv = (LDKUpdateFailHTLC*)obj;
5368         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5369         *ret = UpdateFailHTLC_write(obj_conv);
5370         return (long)ret;
5371 }
5372
5373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
5374         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5375         FREE((void*)ser);
5376         LDKUpdateFailHTLC* ret = MALLOC(sizeof(LDKUpdateFailHTLC), "LDKUpdateFailHTLC");
5377         *ret = UpdateFailHTLC_read(ser_conv);
5378         assert(!ret->_underlying_ref);
5379         ret->_underlying_ref = true;
5380         return (long)ret;
5381 }
5382
5383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
5384         LDKUpdateFailMalformedHTLC* obj_conv = (LDKUpdateFailMalformedHTLC*)obj;
5385         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5386         *ret = UpdateFailMalformedHTLC_write(obj_conv);
5387         return (long)ret;
5388 }
5389
5390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
5391         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5392         FREE((void*)ser);
5393         LDKUpdateFailMalformedHTLC* ret = MALLOC(sizeof(LDKUpdateFailMalformedHTLC), "LDKUpdateFailMalformedHTLC");
5394         *ret = UpdateFailMalformedHTLC_read(ser_conv);
5395         assert(!ret->_underlying_ref);
5396         ret->_underlying_ref = true;
5397         return (long)ret;
5398 }
5399
5400 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1write(JNIEnv * _env, jclass _b, jlong obj) {
5401         LDKUpdateFee* obj_conv = (LDKUpdateFee*)obj;
5402         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5403         *ret = UpdateFee_write(obj_conv);
5404         return (long)ret;
5405 }
5406
5407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFee_1read(JNIEnv * _env, jclass _b, jlong ser) {
5408         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5409         FREE((void*)ser);
5410         LDKUpdateFee* ret = MALLOC(sizeof(LDKUpdateFee), "LDKUpdateFee");
5411         *ret = UpdateFee_read(ser_conv);
5412         assert(!ret->_underlying_ref);
5413         ret->_underlying_ref = true;
5414         return (long)ret;
5415 }
5416
5417 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
5418         LDKUpdateFulfillHTLC* obj_conv = (LDKUpdateFulfillHTLC*)obj;
5419         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5420         *ret = UpdateFulfillHTLC_write(obj_conv);
5421         return (long)ret;
5422 }
5423
5424 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFulfillHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
5425         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5426         FREE((void*)ser);
5427         LDKUpdateFulfillHTLC* ret = MALLOC(sizeof(LDKUpdateFulfillHTLC), "LDKUpdateFulfillHTLC");
5428         *ret = UpdateFulfillHTLC_read(ser_conv);
5429         assert(!ret->_underlying_ref);
5430         ret->_underlying_ref = true;
5431         return (long)ret;
5432 }
5433
5434 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1write(JNIEnv * _env, jclass _b, jlong obj) {
5435         LDKUpdateAddHTLC* obj_conv = (LDKUpdateAddHTLC*)obj;
5436         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5437         *ret = UpdateAddHTLC_write(obj_conv);
5438         return (long)ret;
5439 }
5440
5441 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateAddHTLC_1read(JNIEnv * _env, jclass _b, jlong ser) {
5442         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5443         FREE((void*)ser);
5444         LDKUpdateAddHTLC* ret = MALLOC(sizeof(LDKUpdateAddHTLC), "LDKUpdateAddHTLC");
5445         *ret = UpdateAddHTLC_read(ser_conv);
5446         assert(!ret->_underlying_ref);
5447         ret->_underlying_ref = true;
5448         return (long)ret;
5449 }
5450
5451 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1write(JNIEnv * _env, jclass _b, jlong obj) {
5452         LDKPing* obj_conv = (LDKPing*)obj;
5453         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5454         *ret = Ping_write(obj_conv);
5455         return (long)ret;
5456 }
5457
5458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1read(JNIEnv * _env, jclass _b, jlong ser) {
5459         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5460         FREE((void*)ser);
5461         LDKPing* ret = MALLOC(sizeof(LDKPing), "LDKPing");
5462         *ret = Ping_read(ser_conv);
5463         assert(!ret->_underlying_ref);
5464         ret->_underlying_ref = true;
5465         return (long)ret;
5466 }
5467
5468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1write(JNIEnv * _env, jclass _b, jlong obj) {
5469         LDKPong* obj_conv = (LDKPong*)obj;
5470         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5471         *ret = Pong_write(obj_conv);
5472         return (long)ret;
5473 }
5474
5475 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1read(JNIEnv * _env, jclass _b, jlong ser) {
5476         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5477         FREE((void*)ser);
5478         LDKPong* ret = MALLOC(sizeof(LDKPong), "LDKPong");
5479         *ret = Pong_read(ser_conv);
5480         assert(!ret->_underlying_ref);
5481         ret->_underlying_ref = true;
5482         return (long)ret;
5483 }
5484
5485 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
5486         LDKUnsignedChannelAnnouncement* obj_conv = (LDKUnsignedChannelAnnouncement*)obj;
5487         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5488         *ret = UnsignedChannelAnnouncement_write(obj_conv);
5489         return (long)ret;
5490 }
5491
5492 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
5493         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5494         FREE((void*)ser);
5495         LDKUnsignedChannelAnnouncement* ret = MALLOC(sizeof(LDKUnsignedChannelAnnouncement), "LDKUnsignedChannelAnnouncement");
5496         *ret = UnsignedChannelAnnouncement_read(ser_conv);
5497         assert(!ret->_underlying_ref);
5498         ret->_underlying_ref = true;
5499         return (long)ret;
5500 }
5501
5502 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
5503         LDKChannelAnnouncement* obj_conv = (LDKChannelAnnouncement*)obj;
5504         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5505         *ret = ChannelAnnouncement_write(obj_conv);
5506         return (long)ret;
5507 }
5508
5509 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
5510         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5511         FREE((void*)ser);
5512         LDKChannelAnnouncement* ret = MALLOC(sizeof(LDKChannelAnnouncement), "LDKChannelAnnouncement");
5513         *ret = ChannelAnnouncement_read(ser_conv);
5514         assert(!ret->_underlying_ref);
5515         ret->_underlying_ref = true;
5516         return (long)ret;
5517 }
5518
5519 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5520         LDKUnsignedChannelUpdate* obj_conv = (LDKUnsignedChannelUpdate*)obj;
5521         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5522         *ret = UnsignedChannelUpdate_write(obj_conv);
5523         return (long)ret;
5524 }
5525
5526 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5527         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5528         FREE((void*)ser);
5529         LDKUnsignedChannelUpdate* ret = MALLOC(sizeof(LDKUnsignedChannelUpdate), "LDKUnsignedChannelUpdate");
5530         *ret = UnsignedChannelUpdate_read(ser_conv);
5531         assert(!ret->_underlying_ref);
5532         ret->_underlying_ref = true;
5533         return (long)ret;
5534 }
5535
5536 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1write(JNIEnv * _env, jclass _b, jlong obj) {
5537         LDKChannelUpdate* obj_conv = (LDKChannelUpdate*)obj;
5538         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5539         *ret = ChannelUpdate_write(obj_conv);
5540         return (long)ret;
5541 }
5542
5543 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelUpdate_1read(JNIEnv * _env, jclass _b, jlong ser) {
5544         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5545         FREE((void*)ser);
5546         LDKChannelUpdate* ret = MALLOC(sizeof(LDKChannelUpdate), "LDKChannelUpdate");
5547         *ret = ChannelUpdate_read(ser_conv);
5548         assert(!ret->_underlying_ref);
5549         ret->_underlying_ref = true;
5550         return (long)ret;
5551 }
5552
5553 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1write(JNIEnv * _env, jclass _b, jlong obj) {
5554         LDKErrorMessage* obj_conv = (LDKErrorMessage*)obj;
5555         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5556         *ret = ErrorMessage_write(obj_conv);
5557         return (long)ret;
5558 }
5559
5560 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ErrorMessage_1read(JNIEnv * _env, jclass _b, jlong ser) {
5561         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5562         FREE((void*)ser);
5563         LDKErrorMessage* ret = MALLOC(sizeof(LDKErrorMessage), "LDKErrorMessage");
5564         *ret = ErrorMessage_read(ser_conv);
5565         assert(!ret->_underlying_ref);
5566         ret->_underlying_ref = true;
5567         return (long)ret;
5568 }
5569
5570 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
5571         LDKUnsignedNodeAnnouncement* obj_conv = (LDKUnsignedNodeAnnouncement*)obj;
5572         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5573         *ret = UnsignedNodeAnnouncement_write(obj_conv);
5574         return (long)ret;
5575 }
5576
5577 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedNodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
5578         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5579         FREE((void*)ser);
5580         LDKUnsignedNodeAnnouncement* ret = MALLOC(sizeof(LDKUnsignedNodeAnnouncement), "LDKUnsignedNodeAnnouncement");
5581         *ret = UnsignedNodeAnnouncement_read(ser_conv);
5582         assert(!ret->_underlying_ref);
5583         ret->_underlying_ref = true;
5584         return (long)ret;
5585 }
5586
5587 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1write(JNIEnv * _env, jclass _b, jlong obj) {
5588         LDKNodeAnnouncement* obj_conv = (LDKNodeAnnouncement*)obj;
5589         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5590         *ret = NodeAnnouncement_write(obj_conv);
5591         return (long)ret;
5592 }
5593
5594 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncement_1read(JNIEnv * _env, jclass _b, jlong ser) {
5595         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5596         FREE((void*)ser);
5597         LDKNodeAnnouncement* ret = MALLOC(sizeof(LDKNodeAnnouncement), "LDKNodeAnnouncement");
5598         *ret = NodeAnnouncement_read(ser_conv);
5599         assert(!ret->_underlying_ref);
5600         ret->_underlying_ref = true;
5601         return (long)ret;
5602 }
5603
5604 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5605         LDKMessageHandler this_ptr_conv = *(LDKMessageHandler*)this_ptr;
5606         FREE((void*)this_ptr);
5607         this_ptr_conv._underlying_ref = false;
5608         return MessageHandler_free(this_ptr_conv);
5609 }
5610
5611 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
5612         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
5613         long ret = (long)MessageHandler_get_chan_handler(this_ptr_conv);
5614         return ret;
5615 }
5616
5617 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5618         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
5619         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
5620         LDKChannelMessageHandler_JCalls_clone(val_conv.this_arg);
5621         return MessageHandler_set_chan_handler(this_ptr_conv, val_conv);
5622 }
5623
5624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
5625         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
5626         long ret = (long)MessageHandler_get_route_handler(this_ptr_conv);
5627         return ret;
5628 }
5629
5630 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5631         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
5632         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
5633         LDKRoutingMessageHandler_JCalls_clone(val_conv.this_arg);
5634         return MessageHandler_set_route_handler(this_ptr_conv, val_conv);
5635 }
5636
5637 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1new(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
5638         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
5639         LDKChannelMessageHandler_JCalls_clone(chan_handler_arg_conv.this_arg);
5640         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
5641         LDKRoutingMessageHandler_JCalls_clone(route_handler_arg_conv.this_arg);
5642         LDKMessageHandler* ret = MALLOC(sizeof(LDKMessageHandler), "LDKMessageHandler");
5643         *ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
5644         assert(!ret->_underlying_ref);
5645         ret->_underlying_ref = true;
5646         return (long)ret;
5647 }
5648
5649 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_SocketDescriptor_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5650         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
5651         FREE((void*)this_ptr);
5652         return SocketDescriptor_free(this_ptr_conv);
5653 }
5654
5655 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5656         LDKPeerHandleError this_ptr_conv = *(LDKPeerHandleError*)this_ptr;
5657         FREE((void*)this_ptr);
5658         this_ptr_conv._underlying_ref = false;
5659         return PeerHandleError_free(this_ptr_conv);
5660 }
5661
5662 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1get_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr) {
5663         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
5664         return PeerHandleError_get_no_connection_possible(this_ptr_conv);
5665 }
5666
5667 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1set_1no_1connection_1possible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
5668         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
5669         return PeerHandleError_set_no_connection_possible(this_ptr_conv, val);
5670 }
5671
5672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerHandleError_1new(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
5673         LDKPeerHandleError* ret = MALLOC(sizeof(LDKPeerHandleError), "LDKPeerHandleError");
5674         *ret = PeerHandleError_new(no_connection_possible_arg);
5675         assert(!ret->_underlying_ref);
5676         ret->_underlying_ref = true;
5677         return (long)ret;
5678 }
5679
5680 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5681         LDKPeerManager this_ptr_conv = *(LDKPeerManager*)this_ptr;
5682         FREE((void*)this_ptr);
5683         this_ptr_conv._underlying_ref = false;
5684         return PeerManager_free(this_ptr_conv);
5685 }
5686
5687 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
5688         LDKMessageHandler message_handler_conv = *(LDKMessageHandler*)message_handler;
5689         FREE((void*)message_handler);
5690         message_handler_conv._underlying_ref = false;
5691         LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
5692         FREE((void*)our_node_secret);
5693         unsigned char ephemeral_random_data_arr[32];
5694         (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
5695         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
5696         LDKLogger logger_conv = *(LDKLogger*)logger;
5697         LDKLogger_JCalls_clone(logger_conv.this_arg);
5698         LDKPeerManager* ret = MALLOC(sizeof(LDKPeerManager), "LDKPeerManager");
5699         *ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
5700         assert(!ret->_underlying_ref);
5701         ret->_underlying_ref = true;
5702         return (long)ret;
5703 }
5704
5705 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1get_1peer_1node_1ids(JNIEnv * _env, jclass _b, jlong this_arg) {
5706         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5707         LDKCVec_PublicKeyZ* ret = MALLOC(sizeof(LDKCVec_PublicKeyZ), "LDKCVec_PublicKeyZ");
5708         *ret = PeerManager_get_peer_node_ids(this_arg_conv);
5709         return (long)ret;
5710 }
5711
5712 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1outbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_node_id, jlong descriptor) {
5713         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5714         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
5715         FREE((void*)their_node_id);
5716         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
5717         LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
5718         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ), "LDKCResult_CVec_u8ZPeerHandleErrorZ");
5719         *ret = PeerManager_new_outbound_connection(this_arg_conv, their_node_id_conv, descriptor_conv);
5720         return (long)ret;
5721 }
5722
5723 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1new_1inbound_1connection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
5724         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5725         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
5726         LDKSocketDescriptor_JCalls_clone(descriptor_conv.this_arg);
5727         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5728         *ret = PeerManager_new_inbound_connection(this_arg_conv, descriptor_conv);
5729         return (long)ret;
5730 }
5731
5732 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1write_1buffer_1space_1avail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
5733         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5734         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
5735         LDKCResult_NonePeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_NonePeerHandleErrorZ), "LDKCResult_NonePeerHandleErrorZ");
5736         *ret = PeerManager_write_buffer_space_avail(this_arg_conv, descriptor_conv);
5737         return (long)ret;
5738 }
5739
5740 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PeerManager_1read_1event(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
5741         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5742         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
5743         LDKu8slice data_conv = *(LDKu8slice*)data;
5744         FREE((void*)data);
5745         LDKCResult_boolPeerHandleErrorZ* ret = MALLOC(sizeof(LDKCResult_boolPeerHandleErrorZ), "LDKCResult_boolPeerHandleErrorZ");
5746         *ret = PeerManager_read_event(this_arg_conv, peer_descriptor_conv, data_conv);
5747         return (long)ret;
5748 }
5749
5750 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1process_1events(JNIEnv * _env, jclass _b, jlong this_arg) {
5751         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5752         return PeerManager_process_events(this_arg_conv);
5753 }
5754
5755 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1socket_1disconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
5756         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5757         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
5758         return PeerManager_socket_disconnected(this_arg_conv, descriptor_conv);
5759 }
5760
5761 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PeerManager_1timer_1tick_1occured(JNIEnv * _env, jclass _b, jlong this_arg) {
5762         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
5763         return PeerManager_timer_tick_occured(this_arg_conv);
5764 }
5765
5766 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1commitment_1secret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong idx) {
5767         unsigned char commitment_seed_arr[32];
5768         (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
5769         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
5770         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
5771         *ret = build_commitment_secret(commitment_seed_ref, idx);
5772         return (long)ret;
5773 }
5774
5775 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5776         LDKTxCreationKeys this_ptr_conv = *(LDKTxCreationKeys*)this_ptr;
5777         FREE((void*)this_ptr);
5778         this_ptr_conv._underlying_ref = false;
5779         return TxCreationKeys_free(this_ptr_conv);
5780 }
5781
5782 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5783         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5784         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5785         *ret = TxCreationKeys_get_per_commitment_point(this_ptr_conv);
5786         return (long)ret;
5787 }
5788
5789 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5790         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5791         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5792         FREE((void*)val);
5793         return TxCreationKeys_set_per_commitment_point(this_ptr_conv, val_conv);
5794 }
5795
5796 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5797         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5798         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5799         *ret = TxCreationKeys_get_revocation_key(this_ptr_conv);
5800         return (long)ret;
5801 }
5802
5803 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1revocation_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5804         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5805         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5806         FREE((void*)val);
5807         return TxCreationKeys_set_revocation_key(this_ptr_conv, val_conv);
5808 }
5809
5810 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1a_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5811         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5812         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5813         *ret = TxCreationKeys_get_a_htlc_key(this_ptr_conv);
5814         return (long)ret;
5815 }
5816
5817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1a_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5818         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5819         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5820         FREE((void*)val);
5821         return TxCreationKeys_set_a_htlc_key(this_ptr_conv, val_conv);
5822 }
5823
5824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1b_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5825         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5826         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5827         *ret = TxCreationKeys_get_b_htlc_key(this_ptr_conv);
5828         return (long)ret;
5829 }
5830
5831 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1b_1htlc_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5832         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5833         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5834         FREE((void*)val);
5835         return TxCreationKeys_set_b_htlc_key(this_ptr_conv, val_conv);
5836 }
5837
5838 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1get_1a_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr) {
5839         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5840         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5841         *ret = TxCreationKeys_get_a_delayed_payment_key(this_ptr_conv);
5842         return (long)ret;
5843 }
5844
5845 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1set_1a_1delayed_1payment_1key(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5846         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
5847         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5848         FREE((void*)val);
5849         return TxCreationKeys_set_a_delayed_payment_key(this_ptr_conv, val_conv);
5850 }
5851
5852 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point_arg, jlong revocation_key_arg, jlong a_htlc_key_arg, jlong b_htlc_key_arg, jlong a_delayed_payment_key_arg) {
5853         LDKPublicKey per_commitment_point_arg_conv = *(LDKPublicKey*)per_commitment_point_arg;
5854         FREE((void*)per_commitment_point_arg);
5855         LDKPublicKey revocation_key_arg_conv = *(LDKPublicKey*)revocation_key_arg;
5856         FREE((void*)revocation_key_arg);
5857         LDKPublicKey a_htlc_key_arg_conv = *(LDKPublicKey*)a_htlc_key_arg;
5858         FREE((void*)a_htlc_key_arg);
5859         LDKPublicKey b_htlc_key_arg_conv = *(LDKPublicKey*)b_htlc_key_arg;
5860         FREE((void*)b_htlc_key_arg);
5861         LDKPublicKey a_delayed_payment_key_arg_conv = *(LDKPublicKey*)a_delayed_payment_key_arg;
5862         FREE((void*)a_delayed_payment_key_arg);
5863         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
5864         *ret = TxCreationKeys_new(per_commitment_point_arg_conv, revocation_key_arg_conv, a_htlc_key_arg_conv, b_htlc_key_arg_conv, a_delayed_payment_key_arg_conv);
5865         assert(!ret->_underlying_ref);
5866         ret->_underlying_ref = true;
5867         return (long)ret;
5868 }
5869
5870 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
5871         LDKTxCreationKeys* obj_conv = (LDKTxCreationKeys*)obj;
5872         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
5873         *ret = TxCreationKeys_write(obj_conv);
5874         return (long)ret;
5875 }
5876
5877 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
5878         LDKu8slice ser_conv = *(LDKu8slice*)ser;
5879         FREE((void*)ser);
5880         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
5881         *ret = TxCreationKeys_read(ser_conv);
5882         assert(!ret->_underlying_ref);
5883         ret->_underlying_ref = true;
5884         return (long)ret;
5885 }
5886
5887 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5888         LDKPreCalculatedTxCreationKeys this_ptr_conv = *(LDKPreCalculatedTxCreationKeys*)this_ptr;
5889         FREE((void*)this_ptr);
5890         this_ptr_conv._underlying_ref = false;
5891         return PreCalculatedTxCreationKeys_free(this_ptr_conv);
5892 }
5893
5894 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1new(JNIEnv * _env, jclass _b, jlong keys) {
5895         LDKTxCreationKeys keys_conv = *(LDKTxCreationKeys*)keys;
5896         FREE((void*)keys);
5897         keys_conv._underlying_ref = false;
5898         LDKPreCalculatedTxCreationKeys* ret = MALLOC(sizeof(LDKPreCalculatedTxCreationKeys), "LDKPreCalculatedTxCreationKeys");
5899         *ret = PreCalculatedTxCreationKeys_new(keys_conv);
5900         assert(!ret->_underlying_ref);
5901         ret->_underlying_ref = true;
5902         return (long)ret;
5903 }
5904
5905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
5906         LDKPreCalculatedTxCreationKeys* this_arg_conv = (LDKPreCalculatedTxCreationKeys*)this_arg;
5907         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
5908         *ret = PreCalculatedTxCreationKeys_trust_key_derivation(this_arg_conv);
5909         assert(!ret->_underlying_ref);
5910         ret->_underlying_ref = true;
5911         return (long)ret;
5912 }
5913
5914 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_PreCalculatedTxCreationKeys_1per_1commitment_1point(JNIEnv * _env, jclass _b, jlong this_arg) {
5915         LDKPreCalculatedTxCreationKeys* this_arg_conv = (LDKPreCalculatedTxCreationKeys*)this_arg;
5916         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5917         *ret = PreCalculatedTxCreationKeys_per_commitment_point(this_arg_conv);
5918         return (long)ret;
5919 }
5920
5921 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
5922         LDKChannelPublicKeys this_ptr_conv = *(LDKChannelPublicKeys*)this_ptr;
5923         FREE((void*)this_ptr);
5924         this_ptr_conv._underlying_ref = false;
5925         return ChannelPublicKeys_free(this_ptr_conv);
5926 }
5927
5928 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
5929         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5930         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5931         *ret = ChannelPublicKeys_get_funding_pubkey(this_ptr_conv);
5932         return (long)ret;
5933 }
5934
5935 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5936         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5937         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5938         FREE((void*)val);
5939         return ChannelPublicKeys_set_funding_pubkey(this_ptr_conv, val_conv);
5940 }
5941
5942 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5943         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5944         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5945         *ret = ChannelPublicKeys_get_revocation_basepoint(this_ptr_conv);
5946         return (long)ret;
5947 }
5948
5949 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1revocation_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5950         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5951         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5952         FREE((void*)val);
5953         return ChannelPublicKeys_set_revocation_basepoint(this_ptr_conv, val_conv);
5954 }
5955
5956 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr) {
5957         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5958         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5959         *ret = ChannelPublicKeys_get_payment_point(this_ptr_conv);
5960         return (long)ret;
5961 }
5962
5963 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1payment_1point(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5964         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5965         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5966         FREE((void*)val);
5967         return ChannelPublicKeys_set_payment_point(this_ptr_conv, val_conv);
5968 }
5969
5970 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5971         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5972         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5973         *ret = ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr_conv);
5974         return (long)ret;
5975 }
5976
5977 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1delayed_1payment_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5978         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5979         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5980         FREE((void*)val);
5981         return ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
5982 }
5983
5984 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1get_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
5985         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5986         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
5987         *ret = ChannelPublicKeys_get_htlc_basepoint(this_ptr_conv);
5988         return (long)ret;
5989 }
5990
5991 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1set_1htlc_1basepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
5992         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
5993         LDKPublicKey val_conv = *(LDKPublicKey*)val;
5994         FREE((void*)val);
5995         return ChannelPublicKeys_set_htlc_basepoint(this_ptr_conv, val_conv);
5996 }
5997
5998 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1new(JNIEnv * _env, jclass _b, jlong funding_pubkey_arg, jlong revocation_basepoint_arg, jlong payment_point_arg, jlong delayed_payment_basepoint_arg, jlong htlc_basepoint_arg) {
5999         LDKPublicKey funding_pubkey_arg_conv = *(LDKPublicKey*)funding_pubkey_arg;
6000         FREE((void*)funding_pubkey_arg);
6001         LDKPublicKey revocation_basepoint_arg_conv = *(LDKPublicKey*)revocation_basepoint_arg;
6002         FREE((void*)revocation_basepoint_arg);
6003         LDKPublicKey payment_point_arg_conv = *(LDKPublicKey*)payment_point_arg;
6004         FREE((void*)payment_point_arg);
6005         LDKPublicKey delayed_payment_basepoint_arg_conv = *(LDKPublicKey*)delayed_payment_basepoint_arg;
6006         FREE((void*)delayed_payment_basepoint_arg);
6007         LDKPublicKey htlc_basepoint_arg_conv = *(LDKPublicKey*)htlc_basepoint_arg;
6008         FREE((void*)htlc_basepoint_arg);
6009         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
6010         *ret = ChannelPublicKeys_new(funding_pubkey_arg_conv, revocation_basepoint_arg_conv, payment_point_arg_conv, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
6011         assert(!ret->_underlying_ref);
6012         ret->_underlying_ref = true;
6013         return (long)ret;
6014 }
6015
6016 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1write(JNIEnv * _env, jclass _b, jlong obj) {
6017         LDKChannelPublicKeys* obj_conv = (LDKChannelPublicKeys*)obj;
6018         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6019         *ret = ChannelPublicKeys_write(obj_conv);
6020         return (long)ret;
6021 }
6022
6023 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelPublicKeys_1read(JNIEnv * _env, jclass _b, jlong ser) {
6024         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6025         FREE((void*)ser);
6026         LDKChannelPublicKeys* ret = MALLOC(sizeof(LDKChannelPublicKeys), "LDKChannelPublicKeys");
6027         *ret = ChannelPublicKeys_read(ser_conv);
6028         assert(!ret->_underlying_ref);
6029         ret->_underlying_ref = true;
6030         return (long)ret;
6031 }
6032
6033 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(JNIEnv * _env, jclass _b, jlong per_commitment_point, jlong a_delayed_payment_base, jlong a_htlc_base, jlong b_revocation_base, jlong b_htlc_base) {
6034         LDKPublicKey per_commitment_point_conv = *(LDKPublicKey*)per_commitment_point;
6035         FREE((void*)per_commitment_point);
6036         LDKPublicKey a_delayed_payment_base_conv = *(LDKPublicKey*)a_delayed_payment_base;
6037         FREE((void*)a_delayed_payment_base);
6038         LDKPublicKey a_htlc_base_conv = *(LDKPublicKey*)a_htlc_base;
6039         FREE((void*)a_htlc_base);
6040         LDKPublicKey b_revocation_base_conv = *(LDKPublicKey*)b_revocation_base;
6041         FREE((void*)b_revocation_base);
6042         LDKPublicKey b_htlc_base_conv = *(LDKPublicKey*)b_htlc_base;
6043         FREE((void*)b_htlc_base);
6044         LDKCResult_TxCreationKeysSecpErrorZ* ret = MALLOC(sizeof(LDKCResult_TxCreationKeysSecpErrorZ), "LDKCResult_TxCreationKeysSecpErrorZ");
6045         *ret = TxCreationKeys_derive_new(per_commitment_point_conv, a_delayed_payment_base_conv, a_htlc_base_conv, b_revocation_base_conv, b_htlc_base_conv);
6046         return (long)ret;
6047 }
6048
6049 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jlong revocation_key, jshort to_self_delay, jlong delayed_payment_key) {
6050         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
6051         FREE((void*)revocation_key);
6052         LDKPublicKey delayed_payment_key_conv = *(LDKPublicKey*)delayed_payment_key;
6053         FREE((void*)delayed_payment_key);
6054         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6055         *ret = get_revokeable_redeemscript(revocation_key_conv, to_self_delay, delayed_payment_key_conv);
6056         return (long)ret;
6057 }
6058
6059 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6060         LDKHTLCOutputInCommitment this_ptr_conv = *(LDKHTLCOutputInCommitment*)this_ptr;
6061         FREE((void*)this_ptr);
6062         this_ptr_conv._underlying_ref = false;
6063         return HTLCOutputInCommitment_free(this_ptr_conv);
6064 }
6065
6066 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1offered(JNIEnv * _env, jclass _b, jlong this_ptr) {
6067         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6068         return HTLCOutputInCommitment_get_offered(this_ptr_conv);
6069 }
6070
6071 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1offered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6072         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6073         return HTLCOutputInCommitment_set_offered(this_ptr_conv, val);
6074 }
6075
6076 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6077         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6078         return HTLCOutputInCommitment_get_amount_msat(this_ptr_conv);
6079 }
6080
6081 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1amount_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6082         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6083         return HTLCOutputInCommitment_set_amount_msat(this_ptr_conv, val);
6084 }
6085
6086 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
6087         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6088         return HTLCOutputInCommitment_get_cltv_expiry(this_ptr_conv);
6089 }
6090
6091 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1cltv_1expiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6092         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6093         return HTLCOutputInCommitment_set_cltv_expiry(this_ptr_conv, val);
6094 }
6095
6096 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1get_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr) {
6097         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6098         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6099         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(this_ptr_conv));
6100         return ret_arr;
6101 }
6102
6103 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1set_1payment_1hash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6104         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
6105         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6106         FREE((void*)val);
6107         return HTLCOutputInCommitment_set_payment_hash(this_ptr_conv, val_conv);
6108 }
6109
6110 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1write(JNIEnv * _env, jclass _b, jlong obj) {
6111         LDKHTLCOutputInCommitment* obj_conv = (LDKHTLCOutputInCommitment*)obj;
6112         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6113         *ret = HTLCOutputInCommitment_write(obj_conv);
6114         return (long)ret;
6115 }
6116
6117 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_HTLCOutputInCommitment_1read(JNIEnv * _env, jclass _b, jlong ser) {
6118         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6119         FREE((void*)ser);
6120         LDKHTLCOutputInCommitment* ret = MALLOC(sizeof(LDKHTLCOutputInCommitment), "LDKHTLCOutputInCommitment");
6121         *ret = HTLCOutputInCommitment_read(ser_conv);
6122         assert(!ret->_underlying_ref);
6123         ret->_underlying_ref = true;
6124         return (long)ret;
6125 }
6126
6127 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1htlc_1redeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
6128         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
6129         LDKTxCreationKeys* keys_conv = (LDKTxCreationKeys*)keys;
6130         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6131         *ret = get_htlc_redeemscript(htlc_conv, keys_conv);
6132         return (long)ret;
6133 }
6134
6135 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(JNIEnv * _env, jclass _b, jlong a, jlong b) {
6136         LDKPublicKey a_conv = *(LDKPublicKey*)a;
6137         FREE((void*)a);
6138         LDKPublicKey b_conv = *(LDKPublicKey*)b;
6139         FREE((void*)b);
6140         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6141         *ret = make_funding_redeemscript(a_conv, b_conv);
6142         return (long)ret;
6143 }
6144
6145 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jshort to_self_delay, jlong htlc, jlong a_delayed_payment_key, jlong revocation_key) {
6146         unsigned char prev_hash_arr[32];
6147         (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
6148         unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
6149         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
6150         LDKPublicKey a_delayed_payment_key_conv = *(LDKPublicKey*)a_delayed_payment_key;
6151         FREE((void*)a_delayed_payment_key);
6152         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
6153         FREE((void*)revocation_key);
6154         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6155         *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, to_self_delay, htlc_conv, a_delayed_payment_key_conv, revocation_key_conv);
6156         return (long)ret;
6157 }
6158
6159 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6160         LDKLocalCommitmentTransaction this_ptr_conv = *(LDKLocalCommitmentTransaction*)this_ptr;
6161         FREE((void*)this_ptr);
6162         this_ptr_conv._underlying_ref = false;
6163         return LocalCommitmentTransaction_free(this_ptr_conv);
6164 }
6165
6166 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr) {
6167         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6168         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6169         *ret = LocalCommitmentTransaction_get_unsigned_tx(this_ptr_conv);
6170         return (long)ret;
6171 }
6172
6173 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1set_1unsigned_1tx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6174         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6175         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
6176         FREE((void*)val);
6177         return LocalCommitmentTransaction_set_unsigned_tx(this_ptr_conv, val_conv);
6178 }
6179
6180 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1their_1sig(JNIEnv * _env, jclass _b, jlong this_ptr) {
6181         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6182         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6183         *ret = LocalCommitmentTransaction_get_their_sig(this_ptr_conv);
6184         return (long)ret;
6185 }
6186
6187 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1set_1their_1sig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6188         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6189         LDKSignature val_conv = *(LDKSignature*)val;
6190         FREE((void*)val);
6191         return LocalCommitmentTransaction_set_their_sig(this_ptr_conv, val_conv);
6192 }
6193
6194 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr) {
6195         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6196         return LocalCommitmentTransaction_get_feerate_per_kw(this_ptr_conv);
6197 }
6198
6199 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1set_1feerate_1per_1kw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6200         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6201         return LocalCommitmentTransaction_set_feerate_per_kw(this_ptr_conv, val);
6202 }
6203
6204 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1set_1per_1htlc(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6205         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
6206         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ val_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)val;
6207         FREE((void*)val);
6208         return LocalCommitmentTransaction_set_per_htlc(this_ptr_conv, val_conv);
6209 }
6210
6211 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1new_1missing_1local_1sig(JNIEnv * _env, jclass _b, jlong unsigned_tx, jlong their_sig, jlong our_funding_key, jlong their_funding_key, jlong local_keys, jint feerate_per_kw, jlong htlc_data) {
6212         LDKCVec_u8Z unsigned_tx_conv = *(LDKCVec_u8Z*)unsigned_tx;
6213         FREE((void*)unsigned_tx);
6214         LDKSignature their_sig_conv = *(LDKSignature*)their_sig;
6215         FREE((void*)their_sig);
6216         LDKPublicKey our_funding_key_conv = *(LDKPublicKey*)our_funding_key;
6217         FREE((void*)our_funding_key);
6218         LDKPublicKey their_funding_key_conv = *(LDKPublicKey*)their_funding_key;
6219         FREE((void*)their_funding_key);
6220         LDKTxCreationKeys local_keys_conv = *(LDKTxCreationKeys*)local_keys;
6221         FREE((void*)local_keys);
6222         local_keys_conv._underlying_ref = false;
6223         LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ htlc_data_conv = *(LDKCVec_C2Tuple_HTLCOutputInCommitmentSignatureZZ*)htlc_data;
6224         FREE((void*)htlc_data);
6225         LDKLocalCommitmentTransaction* ret = MALLOC(sizeof(LDKLocalCommitmentTransaction), "LDKLocalCommitmentTransaction");
6226         *ret = LocalCommitmentTransaction_new_missing_local_sig(unsigned_tx_conv, their_sig_conv, our_funding_key_conv, their_funding_key_conv, local_keys_conv, feerate_per_kw, htlc_data_conv);
6227         assert(!ret->_underlying_ref);
6228         ret->_underlying_ref = true;
6229         return (long)ret;
6230 }
6231
6232 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1trust_1key_1derivation(JNIEnv * _env, jclass _b, jlong this_arg) {
6233         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
6234         LDKTxCreationKeys* ret = MALLOC(sizeof(LDKTxCreationKeys), "LDKTxCreationKeys");
6235         *ret = LocalCommitmentTransaction_trust_key_derivation(this_arg_conv);
6236         assert(!ret->_underlying_ref);
6237         ret->_underlying_ref = true;
6238         return (long)ret;
6239 }
6240
6241 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1txid(JNIEnv * _env, jclass _b, jlong this_arg) {
6242         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
6243         LDKThirtyTwoBytes* ret = MALLOC(sizeof(LDKThirtyTwoBytes), "LDKThirtyTwoBytes");
6244         *ret = LocalCommitmentTransaction_txid(this_arg_conv);
6245         return (long)ret;
6246 }
6247
6248 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1local_1sig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) {
6249         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
6250         unsigned char funding_key_arr[32];
6251         (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
6252         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
6253         LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
6254         FREE((void*)funding_redeemscript);
6255         LDKSignature* ret = MALLOC(sizeof(LDKSignature), "LDKSignature");
6256         *ret = LocalCommitmentTransaction_get_local_sig(this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
6257         return (long)ret;
6258 }
6259
6260 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jshort local_csv) {
6261         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
6262         unsigned char htlc_base_key_arr[32];
6263         (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
6264         unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
6265         LDKCResult_CVec_SignatureZNoneZ* ret = MALLOC(sizeof(LDKCResult_CVec_SignatureZNoneZ), "LDKCResult_CVec_SignatureZNoneZ");
6266         *ret = LocalCommitmentTransaction_get_htlc_sigs(this_arg_conv, htlc_base_key_ref, local_csv);
6267         return (long)ret;
6268 }
6269
6270 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1write(JNIEnv * _env, jclass _b, jlong obj) {
6271         LDKLocalCommitmentTransaction* obj_conv = (LDKLocalCommitmentTransaction*)obj;
6272         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6273         *ret = LocalCommitmentTransaction_write(obj_conv);
6274         return (long)ret;
6275 }
6276
6277 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1read(JNIEnv * _env, jclass _b, jlong ser) {
6278         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6279         FREE((void*)ser);
6280         LDKLocalCommitmentTransaction* ret = MALLOC(sizeof(LDKLocalCommitmentTransaction), "LDKLocalCommitmentTransaction");
6281         *ret = LocalCommitmentTransaction_read(ser_conv);
6282         assert(!ret->_underlying_ref);
6283         ret->_underlying_ref = true;
6284         return (long)ret;
6285 }
6286
6287 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_InitFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6288         LDKInitFeatures this_ptr_conv = *(LDKInitFeatures*)this_ptr;
6289         FREE((void*)this_ptr);
6290         this_ptr_conv._underlying_ref = false;
6291         return InitFeatures_free(this_ptr_conv);
6292 }
6293
6294 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6295         LDKNodeFeatures this_ptr_conv = *(LDKNodeFeatures*)this_ptr;
6296         FREE((void*)this_ptr);
6297         this_ptr_conv._underlying_ref = false;
6298         return NodeFeatures_free(this_ptr_conv);
6299 }
6300
6301 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelFeatures_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6302         LDKChannelFeatures this_ptr_conv = *(LDKChannelFeatures*)this_ptr;
6303         FREE((void*)this_ptr);
6304         this_ptr_conv._underlying_ref = false;
6305         return ChannelFeatures_free(this_ptr_conv);
6306 }
6307
6308 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6309         LDKRouteHop this_ptr_conv = *(LDKRouteHop*)this_ptr;
6310         FREE((void*)this_ptr);
6311         this_ptr_conv._underlying_ref = false;
6312         return RouteHop_free(this_ptr_conv);
6313 }
6314
6315 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
6316         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6317         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6318         *ret = RouteHop_get_pubkey(this_ptr_conv);
6319         return (long)ret;
6320 }
6321
6322 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6323         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6324         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6325         FREE((void*)val);
6326         return RouteHop_set_pubkey(this_ptr_conv, val_conv);
6327 }
6328
6329 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6330         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6331         return RouteHop_get_short_channel_id(this_ptr_conv);
6332 }
6333
6334 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6335         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6336         return RouteHop_set_short_channel_id(this_ptr_conv, val);
6337 }
6338
6339 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6340         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6341         return RouteHop_get_fee_msat(this_ptr_conv);
6342 }
6343
6344 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1fee_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6345         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6346         return RouteHop_set_fee_msat(this_ptr_conv, val);
6347 }
6348
6349 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RouteHop_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
6350         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6351         return RouteHop_get_cltv_expiry_delta(this_ptr_conv);
6352 }
6353
6354 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHop_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6355         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
6356         return RouteHop_set_cltv_expiry_delta(this_ptr_conv, val);
6357 }
6358
6359 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6360         LDKRoute this_ptr_conv = *(LDKRoute*)this_ptr;
6361         FREE((void*)this_ptr);
6362         this_ptr_conv._underlying_ref = false;
6363         return Route_free(this_ptr_conv);
6364 }
6365
6366 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Route_1set_1paths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6367         LDKRoute* this_ptr_conv = (LDKRoute*)this_ptr;
6368         LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
6369         FREE((void*)val);
6370         return Route_set_paths(this_ptr_conv, val_conv);
6371 }
6372
6373 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1new(JNIEnv * _env, jclass _b, jlong paths_arg) {
6374         LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
6375         FREE((void*)paths_arg);
6376         LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
6377         *ret = Route_new(paths_arg_conv);
6378         assert(!ret->_underlying_ref);
6379         ret->_underlying_ref = true;
6380         return (long)ret;
6381 }
6382
6383 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1write(JNIEnv * _env, jclass _b, jlong obj) {
6384         LDKRoute* obj_conv = (LDKRoute*)obj;
6385         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6386         *ret = Route_write(obj_conv);
6387         return (long)ret;
6388 }
6389
6390 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Route_1read(JNIEnv * _env, jclass _b, jlong ser) {
6391         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6392         FREE((void*)ser);
6393         LDKRoute* ret = MALLOC(sizeof(LDKRoute), "LDKRoute");
6394         *ret = Route_read(ser_conv);
6395         assert(!ret->_underlying_ref);
6396         ret->_underlying_ref = true;
6397         return (long)ret;
6398 }
6399
6400 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6401         LDKRouteHint this_ptr_conv = *(LDKRouteHint*)this_ptr;
6402         FREE((void*)this_ptr);
6403         this_ptr_conv._underlying_ref = false;
6404         return RouteHint_free(this_ptr_conv);
6405 }
6406
6407 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6408         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6409         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6410         *ret = RouteHint_get_src_node_id(this_ptr_conv);
6411         return (long)ret;
6412 }
6413
6414 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1src_1node_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6415         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6416         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6417         FREE((void*)val);
6418         return RouteHint_set_src_node_id(this_ptr_conv, val_conv);
6419 }
6420
6421 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr) {
6422         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6423         return RouteHint_get_short_channel_id(this_ptr_conv);
6424 }
6425
6426 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1short_1channel_1id(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6427         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6428         return RouteHint_set_short_channel_id(this_ptr_conv, val);
6429 }
6430
6431 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
6432         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6433         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
6434         *ret = RouteHint_get_fees(this_ptr_conv);
6435         assert(!ret->_underlying_ref);
6436         ret->_underlying_ref = true;
6437         return (long)ret;
6438 }
6439
6440 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6441         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6442         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
6443         FREE((void*)val);
6444         val_conv._underlying_ref = false;
6445         return RouteHint_set_fees(this_ptr_conv, val_conv);
6446 }
6447
6448 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
6449         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6450         return RouteHint_get_cltv_expiry_delta(this_ptr_conv);
6451 }
6452
6453 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6454         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6455         return RouteHint_set_cltv_expiry_delta(this_ptr_conv, val);
6456 }
6457
6458 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6459         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6460         return RouteHint_get_htlc_minimum_msat(this_ptr_conv);
6461 }
6462
6463 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6464         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
6465         return RouteHint_set_htlc_minimum_msat(this_ptr_conv, val);
6466 }
6467
6468 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1new(JNIEnv * _env, jclass _b, jlong src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jshort cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
6469         LDKPublicKey src_node_id_arg_conv = *(LDKPublicKey*)src_node_id_arg;
6470         FREE((void*)src_node_id_arg);
6471         LDKRoutingFees fees_arg_conv = *(LDKRoutingFees*)fees_arg;
6472         FREE((void*)fees_arg);
6473         fees_arg_conv._underlying_ref = false;
6474         LDKRouteHint* ret = MALLOC(sizeof(LDKRouteHint), "LDKRouteHint");
6475         *ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
6476         assert(!ret->_underlying_ref);
6477         ret->_underlying_ref = true;
6478         return (long)ret;
6479 }
6480
6481 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1route(JNIEnv * _env, jclass _b, jlong our_node_id, jlong network, jlong target, jlong first_hops, jlong last_hops, jlong final_value_msat, jint final_cltv, jlong logger) {
6482         LDKPublicKey our_node_id_conv = *(LDKPublicKey*)our_node_id;
6483         FREE((void*)our_node_id);
6484         LDKNetworkGraph* network_conv = (LDKNetworkGraph*)network;
6485         LDKPublicKey target_conv = *(LDKPublicKey*)target;
6486         FREE((void*)target);
6487         LDKCVec_ChannelDetailsZ* first_hops_conv = (LDKCVec_ChannelDetailsZ*)first_hops;
6488         LDKCVec_RouteHintZ last_hops_conv = *(LDKCVec_RouteHintZ*)last_hops;
6489         FREE((void*)last_hops);
6490         LDKLogger logger_conv = *(LDKLogger*)logger;
6491         LDKLogger_JCalls_clone(logger_conv.this_arg);
6492         LDKCResult_RouteLightningErrorZ* ret = MALLOC(sizeof(LDKCResult_RouteLightningErrorZ), "LDKCResult_RouteLightningErrorZ");
6493         *ret = get_route(our_node_id_conv, network_conv, target_conv, first_hops_conv, last_hops_conv, final_value_msat, final_cltv, logger_conv);
6494         return (long)ret;
6495 }
6496
6497 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6498         LDKNetworkGraph this_ptr_conv = *(LDKNetworkGraph*)this_ptr;
6499         FREE((void*)this_ptr);
6500         this_ptr_conv._underlying_ref = false;
6501         return NetworkGraph_free(this_ptr_conv);
6502 }
6503
6504 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6505         LDKLockedNetworkGraph this_ptr_conv = *(LDKLockedNetworkGraph*)this_ptr;
6506         FREE((void*)this_ptr);
6507         this_ptr_conv._underlying_ref = false;
6508         return LockedNetworkGraph_free(this_ptr_conv);
6509 }
6510
6511 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6512         LDKNetGraphMsgHandler this_ptr_conv = *(LDKNetGraphMsgHandler*)this_ptr;
6513         FREE((void*)this_ptr);
6514         this_ptr_conv._underlying_ref = false;
6515         return NetGraphMsgHandler_free(this_ptr_conv);
6516 }
6517
6518 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1new(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger) {
6519         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
6520         LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
6521         LDKLogger logger_conv = *(LDKLogger*)logger;
6522         LDKLogger_JCalls_clone(logger_conv.this_arg);
6523         LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
6524         *ret = NetGraphMsgHandler_new(chain_monitor_conv, logger_conv);
6525         assert(!ret->_underlying_ref);
6526         ret->_underlying_ref = true;
6527         return (long)ret;
6528 }
6529
6530 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1from_1net_1graph(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger, jlong network_graph) {
6531         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
6532         LDKChainWatchInterface_JCalls_clone(chain_monitor_conv.this_arg);
6533         LDKLogger logger_conv = *(LDKLogger*)logger;
6534         LDKLogger_JCalls_clone(logger_conv.this_arg);
6535         LDKNetworkGraph network_graph_conv = *(LDKNetworkGraph*)network_graph;
6536         FREE((void*)network_graph);
6537         network_graph_conv._underlying_ref = false;
6538         LDKNetGraphMsgHandler* ret = MALLOC(sizeof(LDKNetGraphMsgHandler), "LDKNetGraphMsgHandler");
6539         *ret = NetGraphMsgHandler_from_net_graph(chain_monitor_conv, logger_conv, network_graph_conv);
6540         assert(!ret->_underlying_ref);
6541         ret->_underlying_ref = true;
6542         return (long)ret;
6543 }
6544
6545 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1read_1locked_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
6546         LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
6547         LDKLockedNetworkGraph* ret = MALLOC(sizeof(LDKLockedNetworkGraph), "LDKLockedNetworkGraph");
6548         *ret = NetGraphMsgHandler_read_locked_graph(this_arg_conv);
6549         assert(!ret->_underlying_ref);
6550         ret->_underlying_ref = true;
6551         return (long)ret;
6552 }
6553
6554 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LockedNetworkGraph_1graph(JNIEnv * _env, jclass _b, jlong this_arg) {
6555         LDKLockedNetworkGraph* this_arg_conv = (LDKLockedNetworkGraph*)this_arg;
6556         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
6557         *ret = LockedNetworkGraph_graph(this_arg_conv);
6558         assert(!ret->_underlying_ref);
6559         ret->_underlying_ref = true;
6560         return (long)ret;
6561 }
6562
6563 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetGraphMsgHandler_1as_1RoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
6564         LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
6565         LDKRoutingMessageHandler* ret = MALLOC(sizeof(LDKRoutingMessageHandler), "LDKRoutingMessageHandler");
6566         *ret = NetGraphMsgHandler_as_RoutingMessageHandler(this_arg_conv);
6567         return (long)ret;
6568 }
6569
6570 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6571         LDKDirectionalChannelInfo this_ptr_conv = *(LDKDirectionalChannelInfo*)this_ptr;
6572         FREE((void*)this_ptr);
6573         this_ptr_conv._underlying_ref = false;
6574         return DirectionalChannelInfo_free(this_ptr_conv);
6575 }
6576
6577 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
6578         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6579         return DirectionalChannelInfo_get_last_update(this_ptr_conv);
6580 }
6581
6582 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6583         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6584         return DirectionalChannelInfo_set_last_update(this_ptr_conv, val);
6585 }
6586
6587 JNIEXPORT jboolean JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
6588         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6589         return DirectionalChannelInfo_get_enabled(this_ptr_conv);
6590 }
6591
6592 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1enabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean val) {
6593         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6594         return DirectionalChannelInfo_set_enabled(this_ptr_conv, val);
6595 }
6596
6597 JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
6598         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6599         return DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr_conv);
6600 }
6601
6602 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
6603         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6604         return DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr_conv, val);
6605 }
6606
6607 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6608         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6609         return DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr_conv);
6610 }
6611
6612 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6613         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
6614         return DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr_conv, val);
6615 }
6616
6617 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
6618         LDKDirectionalChannelInfo* obj_conv = (LDKDirectionalChannelInfo*)obj;
6619         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6620         *ret = DirectionalChannelInfo_write(obj_conv);
6621         return (long)ret;
6622 }
6623
6624 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
6625         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6626         FREE((void*)ser);
6627         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
6628         *ret = DirectionalChannelInfo_read(ser_conv);
6629         assert(!ret->_underlying_ref);
6630         ret->_underlying_ref = true;
6631         return (long)ret;
6632 }
6633
6634 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6635         LDKChannelInfo this_ptr_conv = *(LDKChannelInfo*)this_ptr;
6636         FREE((void*)this_ptr);
6637         this_ptr_conv._underlying_ref = false;
6638         return ChannelInfo_free(this_ptr_conv);
6639 }
6640
6641 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
6642         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6643         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6644         *ret = ChannelInfo_get_node_one(this_ptr_conv);
6645         return (long)ret;
6646 }
6647
6648 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6649         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6650         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6651         FREE((void*)val);
6652         return ChannelInfo_set_node_one(this_ptr_conv, val_conv);
6653 }
6654
6655 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
6656         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6657         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
6658         *ret = ChannelInfo_get_one_to_two(this_ptr_conv);
6659         assert(!ret->_underlying_ref);
6660         ret->_underlying_ref = true;
6661         return (long)ret;
6662 }
6663
6664 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1one_1to_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6665         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6666         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
6667         FREE((void*)val);
6668         val_conv._underlying_ref = false;
6669         return ChannelInfo_set_one_to_two(this_ptr_conv, val_conv);
6670 }
6671
6672 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr) {
6673         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6674         LDKPublicKey* ret = MALLOC(sizeof(LDKPublicKey), "LDKPublicKey");
6675         *ret = ChannelInfo_get_node_two(this_ptr_conv);
6676         return (long)ret;
6677 }
6678
6679 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1node_1two(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6680         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6681         LDKPublicKey val_conv = *(LDKPublicKey*)val;
6682         FREE((void*)val);
6683         return ChannelInfo_set_node_two(this_ptr_conv, val_conv);
6684 }
6685
6686 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1get_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr) {
6687         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6688         LDKDirectionalChannelInfo* ret = MALLOC(sizeof(LDKDirectionalChannelInfo), "LDKDirectionalChannelInfo");
6689         *ret = ChannelInfo_get_two_to_one(this_ptr_conv);
6690         assert(!ret->_underlying_ref);
6691         ret->_underlying_ref = true;
6692         return (long)ret;
6693 }
6694
6695 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1set_1two_1to_1one(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6696         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
6697         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
6698         FREE((void*)val);
6699         val_conv._underlying_ref = false;
6700         return ChannelInfo_set_two_to_one(this_ptr_conv, val_conv);
6701 }
6702
6703 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
6704         LDKChannelInfo* obj_conv = (LDKChannelInfo*)obj;
6705         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6706         *ret = ChannelInfo_write(obj_conv);
6707         return (long)ret;
6708 }
6709
6710 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
6711         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6712         FREE((void*)ser);
6713         LDKChannelInfo* ret = MALLOC(sizeof(LDKChannelInfo), "LDKChannelInfo");
6714         *ret = ChannelInfo_read(ser_conv);
6715         assert(!ret->_underlying_ref);
6716         ret->_underlying_ref = true;
6717         return (long)ret;
6718 }
6719
6720 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6721         LDKRoutingFees this_ptr_conv = *(LDKRoutingFees*)this_ptr;
6722         FREE((void*)this_ptr);
6723         this_ptr_conv._underlying_ref = false;
6724         return RoutingFees_free(this_ptr_conv);
6725 }
6726
6727 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
6728         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
6729         return RoutingFees_get_base_msat(this_ptr_conv);
6730 }
6731
6732 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1base_1msat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6733         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
6734         return RoutingFees_set_base_msat(this_ptr_conv, val);
6735 }
6736
6737 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_RoutingFees_1get_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
6738         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
6739         return RoutingFees_get_proportional_millionths(this_ptr_conv);
6740 }
6741
6742 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RoutingFees_1set_1proportional_1millionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6743         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
6744         return RoutingFees_set_proportional_millionths(this_ptr_conv, val);
6745 }
6746
6747 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1new(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
6748         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
6749         *ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
6750         assert(!ret->_underlying_ref);
6751         ret->_underlying_ref = true;
6752         return (long)ret;
6753 }
6754
6755 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1read(JNIEnv * _env, jclass _b, jlong ser) {
6756         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6757         FREE((void*)ser);
6758         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
6759         *ret = RoutingFees_read(ser_conv);
6760         assert(!ret->_underlying_ref);
6761         ret->_underlying_ref = true;
6762         return (long)ret;
6763 }
6764
6765 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RoutingFees_1write(JNIEnv * _env, jclass _b, jlong obj) {
6766         LDKRoutingFees* obj_conv = (LDKRoutingFees*)obj;
6767         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6768         *ret = RoutingFees_write(obj_conv);
6769         return (long)ret;
6770 }
6771
6772 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6773         LDKNodeAnnouncementInfo this_ptr_conv = *(LDKNodeAnnouncementInfo*)this_ptr;
6774         FREE((void*)this_ptr);
6775         this_ptr_conv._underlying_ref = false;
6776         return NodeAnnouncementInfo_free(this_ptr_conv);
6777 }
6778
6779 JNIEXPORT jint JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr) {
6780         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6781         return NodeAnnouncementInfo_get_last_update(this_ptr_conv);
6782 }
6783
6784 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1last_1update(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
6785         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6786         return NodeAnnouncementInfo_set_last_update(this_ptr_conv, val);
6787 }
6788
6789 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
6790         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6791         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 3);
6792         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(this_ptr_conv));
6793         return ret_arr;
6794 }
6795
6796 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1rgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6797         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6798         LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
6799         FREE((void*)val);
6800         return NodeAnnouncementInfo_set_rgb(this_ptr_conv, val_conv);
6801 }
6802
6803 JNIEXPORT jbyteArray JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1get_1alias(JNIEnv * _env, jclass _b, jlong this_ptr) {
6804         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6805         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 32);
6806         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(this_ptr_conv));
6807         return ret_arr;
6808 }
6809
6810 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1alias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6811         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6812         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
6813         FREE((void*)val);
6814         return NodeAnnouncementInfo_set_alias(this_ptr_conv, val_conv);
6815 }
6816
6817 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1set_1addresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6818         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
6819         LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
6820         FREE((void*)val);
6821         return NodeAnnouncementInfo_set_addresses(this_ptr_conv, val_conv);
6822 }
6823
6824 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
6825         LDKNodeAnnouncementInfo* obj_conv = (LDKNodeAnnouncementInfo*)obj;
6826         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6827         *ret = NodeAnnouncementInfo_write(obj_conv);
6828         return (long)ret;
6829 }
6830
6831 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeAnnouncementInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
6832         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6833         FREE((void*)ser);
6834         LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
6835         *ret = NodeAnnouncementInfo_read(ser_conv);
6836         assert(!ret->_underlying_ref);
6837         ret->_underlying_ref = true;
6838         return (long)ret;
6839 }
6840
6841 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
6842         LDKNodeInfo this_ptr_conv = *(LDKNodeInfo*)this_ptr;
6843         FREE((void*)this_ptr);
6844         this_ptr_conv._underlying_ref = false;
6845         return NodeInfo_free(this_ptr_conv);
6846 }
6847
6848 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1channels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6849         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
6850         LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
6851         FREE((void*)val);
6852         return NodeInfo_set_channels(this_ptr_conv, val_conv);
6853 }
6854
6855 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr) {
6856         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
6857         LDKRoutingFees* ret = MALLOC(sizeof(LDKRoutingFees), "LDKRoutingFees");
6858         *ret = NodeInfo_get_lowest_inbound_channel_fees(this_ptr_conv);
6859         assert(!ret->_underlying_ref);
6860         ret->_underlying_ref = true;
6861         return (long)ret;
6862 }
6863
6864 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1lowest_1inbound_1channel_1fees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6865         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
6866         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
6867         FREE((void*)val);
6868         val_conv._underlying_ref = false;
6869         return NodeInfo_set_lowest_inbound_channel_fees(this_ptr_conv, val_conv);
6870 }
6871
6872 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1get_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr) {
6873         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
6874         LDKNodeAnnouncementInfo* ret = MALLOC(sizeof(LDKNodeAnnouncementInfo), "LDKNodeAnnouncementInfo");
6875         *ret = NodeInfo_get_announcement_info(this_ptr_conv);
6876         assert(!ret->_underlying_ref);
6877         ret->_underlying_ref = true;
6878         return (long)ret;
6879 }
6880
6881 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_NodeInfo_1set_1announcement_1info(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
6882         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
6883         LDKNodeAnnouncementInfo val_conv = *(LDKNodeAnnouncementInfo*)val;
6884         FREE((void*)val);
6885         val_conv._underlying_ref = false;
6886         return NodeInfo_set_announcement_info(this_ptr_conv, val_conv);
6887 }
6888
6889 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1new(JNIEnv * _env, jclass _b, jlong channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
6890         LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
6891         FREE((void*)channels_arg);
6892         LDKRoutingFees lowest_inbound_channel_fees_arg_conv = *(LDKRoutingFees*)lowest_inbound_channel_fees_arg;
6893         FREE((void*)lowest_inbound_channel_fees_arg);
6894         lowest_inbound_channel_fees_arg_conv._underlying_ref = false;
6895         LDKNodeAnnouncementInfo announcement_info_arg_conv = *(LDKNodeAnnouncementInfo*)announcement_info_arg;
6896         FREE((void*)announcement_info_arg);
6897         announcement_info_arg_conv._underlying_ref = false;
6898         LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
6899         *ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
6900         assert(!ret->_underlying_ref);
6901         ret->_underlying_ref = true;
6902         return (long)ret;
6903 }
6904
6905 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1write(JNIEnv * _env, jclass _b, jlong obj) {
6906         LDKNodeInfo* obj_conv = (LDKNodeInfo*)obj;
6907         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6908         *ret = NodeInfo_write(obj_conv);
6909         return (long)ret;
6910 }
6911
6912 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NodeInfo_1read(JNIEnv * _env, jclass _b, jlong ser) {
6913         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6914         FREE((void*)ser);
6915         LDKNodeInfo* ret = MALLOC(sizeof(LDKNodeInfo), "LDKNodeInfo");
6916         *ret = NodeInfo_read(ser_conv);
6917         assert(!ret->_underlying_ref);
6918         ret->_underlying_ref = true;
6919         return (long)ret;
6920 }
6921
6922 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1write(JNIEnv * _env, jclass _b, jlong obj) {
6923         LDKNetworkGraph* obj_conv = (LDKNetworkGraph*)obj;
6924         LDKCVec_u8Z* ret = MALLOC(sizeof(LDKCVec_u8Z), "LDKCVec_u8Z");
6925         *ret = NetworkGraph_write(obj_conv);
6926         return (long)ret;
6927 }
6928
6929 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1read(JNIEnv * _env, jclass _b, jlong ser) {
6930         LDKu8slice ser_conv = *(LDKu8slice*)ser;
6931         FREE((void*)ser);
6932         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
6933         *ret = NetworkGraph_read(ser_conv);
6934         assert(!ret->_underlying_ref);
6935         ret->_underlying_ref = true;
6936         return (long)ret;
6937 }
6938
6939 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_NetworkGraph_1new(JNIEnv * _env, jclass _b) {
6940         LDKNetworkGraph* ret = MALLOC(sizeof(LDKNetworkGraph), "LDKNetworkGraph");
6941         *ret = NetworkGraph_new();
6942         assert(!ret->_underlying_ref);
6943         ret->_underlying_ref = true;
6944         return (long)ret;
6945 }
6946
6947 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) {
6948         LDKNetworkGraph* this_arg_conv = (LDKNetworkGraph*)this_arg;
6949         return NetworkGraph_close_channel_from_update(this_arg_conv, short_channel_id, is_permanent);
6950 }
6951