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