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