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