Also output a C wrapper that correctly wraps all the JNI functions
[ldk-java] / src / main / jni / bindings.c
1 #include "org_ldk_bindings.h"
2 #include <rust_types.h>
3
4 #include <lightning.h>
5
6 JNIEXPORT void JNICALL C2TupleOutPointScriptZfree(JNIEnv * _env, jclass _b, jlong arg) {
7         LDKC2Tuple_OutPointScriptZ arg_conv = *(LDKC2Tuple_OutPointScriptZ*)arg;
8         return C2Tuple_OutPointScriptZ_free(arg_conv);
9 }
10
11 JNIEXPORT void JNICALL C2TupleScriptu64Zfree(JNIEnv * _env, jclass _b, jlong arg) {
12         LDKC2Tuple_Scriptu64Z arg_conv = *(LDKC2Tuple_Scriptu64Z*)arg;
13         return C2Tuple_Scriptu64Z_free(arg_conv);
14 }
15
16 JNIEXPORT void JNICALL C2TupleSecretKeyu832Zfree(JNIEnv * _env, jclass _b, jlong arg) {
17         LDKC2Tuple_SecretKey_u832Z arg_conv = *(LDKC2Tuple_SecretKey_u832Z*)arg;
18         return C2Tuple_SecretKey_u832Z_free(arg_conv);
19 }
20
21 JNIEXPORT void JNICALL C2TupleSignatureCVecSignatureZZfree(JNIEnv * _env, jclass _b, jlong arg) {
22         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
23         return C2Tuple_SignatureCVec_SignatureZZ_free(arg_conv);
24 }
25
26 JNIEXPORT void JNICALL C2TupleTxidu32Zfree(JNIEnv * _env, jclass _b, jlong arg) {
27         LDKC2Tuple_Txidu32Z arg_conv = *(LDKC2Tuple_Txidu32Z*)arg;
28         return C2Tuple_Txidu32Z_free(arg_conv);
29 }
30
31 JNIEXPORT void JNICALL C2Tupleu64u64Zfree(JNIEnv * _env, jclass _b, jlong arg) {
32         LDKC2Tuple_u64u64Z arg_conv = *(LDKC2Tuple_u64u64Z*)arg;
33         return C2Tuple_u64u64Z_free(arg_conv);
34 }
35
36 JNIEXPORT void JNICALL C3TupleChannelAnnouncementChannelUpdateChannelUpdateZfree(JNIEnv * _env, jclass _b, jlong arg) {
37         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ arg_conv = *(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ*)arg;
38         return C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_free(arg_conv);
39 }
40
41 JNIEXPORT jlong JNICALL CResultC2TupleScriptu64ZChainErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
42         LDKChainError arg_conv = *(LDKChainError*)arg;
43         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = malloc(sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ));
44         *ret = CResult_C2Tuple_Scriptu64ZChainErrorZ_err(arg_conv);
45         return (long)ret;
46 }
47
48 JNIEXPORT void JNICALL CResultC2TupleScriptu64ZChainErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
49         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ arg_conv = *(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ*)arg;
50         return CResult_C2Tuple_Scriptu64ZChainErrorZ_free(arg_conv);
51 }
52
53 JNIEXPORT jlong JNICALL CResultC2TupleScriptu64ZChainErrorZgood(JNIEnv * _env, jclass _b, jlong arg) {
54         LDKC2Tuple_Scriptu64Z arg_conv = *(LDKC2Tuple_Scriptu64Z*)arg;
55         LDKCResult_C2Tuple_Scriptu64ZChainErrorZ* ret = malloc(sizeof(LDKCResult_C2Tuple_Scriptu64ZChainErrorZ));
56         *ret = CResult_C2Tuple_Scriptu64ZChainErrorZ_good(arg_conv);
57         return (long)ret;
58 }
59
60 JNIEXPORT void JNICALL CResultC2TupleSignatureCVecSignatureZZNoneZfree(JNIEnv * _env, jclass _b, jlong arg) {
61         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ arg_conv = *(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ*)arg;
62         return CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_free(arg_conv);
63 }
64
65 JNIEXPORT jlong JNICALL CResultC2TupleSignatureCVecSignatureZZNoneZgood(JNIEnv * _env, jclass _b, jlong arg) {
66         LDKC2Tuple_SignatureCVec_SignatureZZ arg_conv = *(LDKC2Tuple_SignatureCVec_SignatureZZ*)arg;
67         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = malloc(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ));
68         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_good(arg_conv);
69         return (long)ret;
70 }
71
72 JNIEXPORT void JNICALL CResultCVecSignatureZNoneZfree(JNIEnv * _env, jclass _b, jlong arg) {
73         LDKCResult_CVec_SignatureZNoneZ arg_conv = *(LDKCResult_CVec_SignatureZNoneZ*)arg;
74         return CResult_CVec_SignatureZNoneZ_free(arg_conv);
75 }
76
77 JNIEXPORT jlong JNICALL CResultCVecSignatureZNoneZgood(JNIEnv * _env, jclass _b, jlong arg) {
78         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
79         LDKCResult_CVec_SignatureZNoneZ* ret = malloc(sizeof(LDKCResult_CVec_SignatureZNoneZ));
80         *ret = CResult_CVec_SignatureZNoneZ_good(arg_conv);
81         return (long)ret;
82 }
83
84 JNIEXPORT jlong JNICALL CResultCVecu8ZPeerHandleErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
85         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
86         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ));
87         *ret = CResult_CVec_u8ZPeerHandleErrorZ_err(arg_conv);
88         return (long)ret;
89 }
90
91 JNIEXPORT void JNICALL CResultCVecu8ZPeerHandleErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
92         LDKCResult_CVec_u8ZPeerHandleErrorZ arg_conv = *(LDKCResult_CVec_u8ZPeerHandleErrorZ*)arg;
93         return CResult_CVec_u8ZPeerHandleErrorZ_free(arg_conv);
94 }
95
96 JNIEXPORT jlong JNICALL CResultCVecu8ZPeerHandleErrorZgood(JNIEnv * _env, jclass _b, jlong arg) {
97         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
98         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ));
99         *ret = CResult_CVec_u8ZPeerHandleErrorZ_good(arg_conv);
100         return (long)ret;
101 }
102
103 JNIEXPORT jlong JNICALL CResultNoneAPIErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
104         LDKAPIError arg_conv = *(LDKAPIError*)arg;
105         LDKCResult_NoneAPIErrorZ* ret = malloc(sizeof(LDKCResult_NoneAPIErrorZ));
106         *ret = CResult_NoneAPIErrorZ_err(arg_conv);
107         return (long)ret;
108 }
109
110 JNIEXPORT void JNICALL CResultNoneAPIErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
111         LDKCResult_NoneAPIErrorZ arg_conv = *(LDKCResult_NoneAPIErrorZ*)arg;
112         return CResult_NoneAPIErrorZ_free(arg_conv);
113 }
114
115 JNIEXPORT jlong JNICALL CResultNoneChannelMonitorUpdateErrZerr(JNIEnv * _env, jclass _b, jlong arg) {
116         LDKChannelMonitorUpdateErr arg_conv = *(LDKChannelMonitorUpdateErr*)arg;
117         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = malloc(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ));
118         *ret = CResult_NoneChannelMonitorUpdateErrZ_err(arg_conv);
119         return (long)ret;
120 }
121
122 JNIEXPORT void JNICALL CResultNoneChannelMonitorUpdateErrZfree(JNIEnv * _env, jclass _b, jlong arg) {
123         LDKCResult_NoneChannelMonitorUpdateErrZ arg_conv = *(LDKCResult_NoneChannelMonitorUpdateErrZ*)arg;
124         return CResult_NoneChannelMonitorUpdateErrZ_free(arg_conv);
125 }
126
127 JNIEXPORT jlong JNICALL CResultNoneMonitorUpdateErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
128         LDKMonitorUpdateError arg_conv = *(LDKMonitorUpdateError*)arg;
129         LDKCResult_NoneMonitorUpdateErrorZ* ret = malloc(sizeof(LDKCResult_NoneMonitorUpdateErrorZ));
130         *ret = CResult_NoneMonitorUpdateErrorZ_err(arg_conv);
131         return (long)ret;
132 }
133
134 JNIEXPORT void JNICALL CResultNoneMonitorUpdateErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
135         LDKCResult_NoneMonitorUpdateErrorZ arg_conv = *(LDKCResult_NoneMonitorUpdateErrorZ*)arg;
136         return CResult_NoneMonitorUpdateErrorZ_free(arg_conv);
137 }
138
139 JNIEXPORT jlong JNICALL CResultNonePaymentSendFailureZerr(JNIEnv * _env, jclass _b, jlong arg) {
140         LDKPaymentSendFailure arg_conv = *(LDKPaymentSendFailure*)arg;
141         LDKCResult_NonePaymentSendFailureZ* ret = malloc(sizeof(LDKCResult_NonePaymentSendFailureZ));
142         *ret = CResult_NonePaymentSendFailureZ_err(arg_conv);
143         return (long)ret;
144 }
145
146 JNIEXPORT void JNICALL CResultNonePaymentSendFailureZfree(JNIEnv * _env, jclass _b, jlong arg) {
147         LDKCResult_NonePaymentSendFailureZ arg_conv = *(LDKCResult_NonePaymentSendFailureZ*)arg;
148         return CResult_NonePaymentSendFailureZ_free(arg_conv);
149 }
150
151 JNIEXPORT jlong JNICALL CResultNonePeerHandleErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
152         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
153         LDKCResult_NonePeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_NonePeerHandleErrorZ));
154         *ret = CResult_NonePeerHandleErrorZ_err(arg_conv);
155         return (long)ret;
156 }
157
158 JNIEXPORT void JNICALL CResultNonePeerHandleErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
159         LDKCResult_NonePeerHandleErrorZ arg_conv = *(LDKCResult_NonePeerHandleErrorZ*)arg;
160         return CResult_NonePeerHandleErrorZ_free(arg_conv);
161 }
162
163 JNIEXPORT jlong JNICALL CResultRouteLightningErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
164         LDKLightningError arg_conv = *(LDKLightningError*)arg;
165         LDKCResult_RouteLightningErrorZ* ret = malloc(sizeof(LDKCResult_RouteLightningErrorZ));
166         *ret = CResult_RouteLightningErrorZ_err(arg_conv);
167         return (long)ret;
168 }
169
170 JNIEXPORT void JNICALL CResultRouteLightningErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
171         LDKCResult_RouteLightningErrorZ arg_conv = *(LDKCResult_RouteLightningErrorZ*)arg;
172         return CResult_RouteLightningErrorZ_free(arg_conv);
173 }
174
175 JNIEXPORT jlong JNICALL CResultRouteLightningErrorZgood(JNIEnv * _env, jclass _b, jlong arg) {
176         LDKRoute arg_conv = *(LDKRoute*)arg;
177         LDKCResult_RouteLightningErrorZ* ret = malloc(sizeof(LDKCResult_RouteLightningErrorZ));
178         *ret = CResult_RouteLightningErrorZ_good(arg_conv);
179         return (long)ret;
180 }
181
182 JNIEXPORT void JNICALL CResultSignatureNoneZfree(JNIEnv * _env, jclass _b, jlong arg) {
183         LDKCResult_SignatureNoneZ arg_conv = *(LDKCResult_SignatureNoneZ*)arg;
184         return CResult_SignatureNoneZ_free(arg_conv);
185 }
186
187 JNIEXPORT jlong JNICALL CResultSignatureNoneZgood(JNIEnv * _env, jclass _b, jlong arg) {
188         LDKSignature arg_conv = *(LDKSignature*)arg;
189         LDKCResult_SignatureNoneZ* ret = malloc(sizeof(LDKCResult_SignatureNoneZ));
190         *ret = CResult_SignatureNoneZ_good(arg_conv);
191         return (long)ret;
192 }
193
194 JNIEXPORT jlong JNICALL CResultboolLightningErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
195         LDKLightningError arg_conv = *(LDKLightningError*)arg;
196         LDKCResult_boolLightningErrorZ* ret = malloc(sizeof(LDKCResult_boolLightningErrorZ));
197         *ret = CResult_boolLightningErrorZ_err(arg_conv);
198         return (long)ret;
199 }
200
201 JNIEXPORT void JNICALL CResultboolLightningErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
202         LDKCResult_boolLightningErrorZ arg_conv = *(LDKCResult_boolLightningErrorZ*)arg;
203         return CResult_boolLightningErrorZ_free(arg_conv);
204 }
205
206 JNIEXPORT jlong JNICALL CResultboolLightningErrorZgood(JNIEnv * _env, jclass _b, jboolean arg) {
207         LDKCResult_boolLightningErrorZ* ret = malloc(sizeof(LDKCResult_boolLightningErrorZ));
208         *ret = CResult_boolLightningErrorZ_good(arg);
209         return (long)ret;
210 }
211
212 JNIEXPORT jlong JNICALL CResultboolPeerHandleErrorZerr(JNIEnv * _env, jclass _b, jlong arg) {
213         LDKPeerHandleError arg_conv = *(LDKPeerHandleError*)arg;
214         LDKCResult_boolPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_boolPeerHandleErrorZ));
215         *ret = CResult_boolPeerHandleErrorZ_err(arg_conv);
216         return (long)ret;
217 }
218
219 JNIEXPORT void JNICALL CResultboolPeerHandleErrorZfree(JNIEnv * _env, jclass _b, jlong arg) {
220         LDKCResult_boolPeerHandleErrorZ arg_conv = *(LDKCResult_boolPeerHandleErrorZ*)arg;
221         return CResult_boolPeerHandleErrorZ_free(arg_conv);
222 }
223
224 JNIEXPORT jlong JNICALL CResultboolPeerHandleErrorZgood(JNIEnv * _env, jclass _b, jboolean arg) {
225         LDKCResult_boolPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_boolPeerHandleErrorZ));
226         *ret = CResult_boolPeerHandleErrorZ_good(arg);
227         return (long)ret;
228 }
229
230 JNIEXPORT void JNICALL CVecC3TupleChannelAnnouncementChannelUpdateChannelUpdateZZfree(JNIEnv * _env, jclass _b, jlong arg) {
231         LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ arg_conv = *(LDKCVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ*)arg;
232         return CVec_C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZZ_free(arg_conv);
233 }
234
235 JNIEXPORT void JNICALL CVecCVecRouteHopZZfree(JNIEnv * _env, jclass _b, jlong arg) {
236         LDKCVec_CVec_RouteHopZZ arg_conv = *(LDKCVec_CVec_RouteHopZZ*)arg;
237         return CVec_CVec_RouteHopZZ_free(arg_conv);
238 }
239
240 JNIEXPORT void JNICALL CVecChannelDetailsZfree(JNIEnv * _env, jclass _b, jlong arg) {
241         LDKCVec_ChannelDetailsZ arg_conv = *(LDKCVec_ChannelDetailsZ*)arg;
242         return CVec_ChannelDetailsZ_free(arg_conv);
243 }
244
245 JNIEXPORT void JNICALL CVecEventZfree(JNIEnv * _env, jclass _b, jlong arg) {
246         LDKCVec_EventZ arg_conv = *(LDKCVec_EventZ*)arg;
247         return CVec_EventZ_free(arg_conv);
248 }
249
250 JNIEXPORT void JNICALL CVecHTLCUpdateZfree(JNIEnv * _env, jclass _b, jlong arg) {
251         LDKCVec_HTLCUpdateZ arg_conv = *(LDKCVec_HTLCUpdateZ*)arg;
252         return CVec_HTLCUpdateZ_free(arg_conv);
253 }
254
255 JNIEXPORT void JNICALL CVecMessageSendEventZfree(JNIEnv * _env, jclass _b, jlong arg) {
256         LDKCVec_MessageSendEventZ arg_conv = *(LDKCVec_MessageSendEventZ*)arg;
257         return CVec_MessageSendEventZ_free(arg_conv);
258 }
259
260 JNIEXPORT void JNICALL CVecNetAddressZfree(JNIEnv * _env, jclass _b, jlong arg) {
261         LDKCVec_NetAddressZ arg_conv = *(LDKCVec_NetAddressZ*)arg;
262         return CVec_NetAddressZ_free(arg_conv);
263 }
264
265 JNIEXPORT void JNICALL CVecNodeAnnouncementZfree(JNIEnv * _env, jclass _b, jlong arg) {
266         LDKCVec_NodeAnnouncementZ arg_conv = *(LDKCVec_NodeAnnouncementZ*)arg;
267         return CVec_NodeAnnouncementZ_free(arg_conv);
268 }
269
270 JNIEXPORT void JNICALL CVecPublicKeyZfree(JNIEnv * _env, jclass _b, jlong arg) {
271         LDKCVec_PublicKeyZ arg_conv = *(LDKCVec_PublicKeyZ*)arg;
272         return CVec_PublicKeyZ_free(arg_conv);
273 }
274
275 JNIEXPORT void JNICALL CVecRouteHopZfree(JNIEnv * _env, jclass _b, jlong arg) {
276         LDKCVec_RouteHopZ arg_conv = *(LDKCVec_RouteHopZ*)arg;
277         return CVec_RouteHopZ_free(arg_conv);
278 }
279
280 JNIEXPORT void JNICALL CVecSignatureZfree(JNIEnv * _env, jclass _b, jlong arg) {
281         LDKCVec_SignatureZ arg_conv = *(LDKCVec_SignatureZ*)arg;
282         return CVec_SignatureZ_free(arg_conv);
283 }
284
285 JNIEXPORT void JNICALL CVecSpendableOutputDescriptorZfree(JNIEnv * _env, jclass _b, jlong arg) {
286         LDKCVec_SpendableOutputDescriptorZ arg_conv = *(LDKCVec_SpendableOutputDescriptorZ*)arg;
287         return CVec_SpendableOutputDescriptorZ_free(arg_conv);
288 }
289
290 JNIEXPORT void JNICALL CVecTransactionZfree(JNIEnv * _env, jclass _b, jlong arg) {
291         LDKCVec_TransactionZ arg_conv = *(LDKCVec_TransactionZ*)arg;
292         return CVec_TransactionZ_free(arg_conv);
293 }
294
295 JNIEXPORT void JNICALL CVecUpdateAddHTLCZfree(JNIEnv * _env, jclass _b, jlong arg) {
296         LDKCVec_UpdateAddHTLCZ arg_conv = *(LDKCVec_UpdateAddHTLCZ*)arg;
297         return CVec_UpdateAddHTLCZ_free(arg_conv);
298 }
299
300 JNIEXPORT void JNICALL CVecUpdateFailHTLCZfree(JNIEnv * _env, jclass _b, jlong arg) {
301         LDKCVec_UpdateFailHTLCZ arg_conv = *(LDKCVec_UpdateFailHTLCZ*)arg;
302         return CVec_UpdateFailHTLCZ_free(arg_conv);
303 }
304
305 JNIEXPORT void JNICALL CVecUpdateFailMalformedHTLCZfree(JNIEnv * _env, jclass _b, jlong arg) {
306         LDKCVec_UpdateFailMalformedHTLCZ arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)arg;
307         return CVec_UpdateFailMalformedHTLCZ_free(arg_conv);
308 }
309
310 JNIEXPORT void JNICALL CVecUpdateFulfillHTLCZfree(JNIEnv * _env, jclass _b, jlong arg) {
311         LDKCVec_UpdateFulfillHTLCZ arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)arg;
312         return CVec_UpdateFulfillHTLCZ_free(arg_conv);
313 }
314
315 JNIEXPORT void JNICALL CVecu64Zfree(JNIEnv * _env, jclass _b, jlong arg) {
316         LDKCVec_u64Z arg_conv = *(LDKCVec_u64Z*)arg;
317         return CVec_u64Z_free(arg_conv);
318 }
319
320 JNIEXPORT void JNICALL CVecu8Zfree(JNIEnv * _env, jclass _b, jlong arg) {
321         LDKCVec_u8Z arg_conv = *(LDKCVec_u8Z*)arg;
322         return CVec_u8Z_free(arg_conv);
323 }
324
325 JNIEXPORT void JNICALL CVecusizeZfree(JNIEnv * _env, jclass _b, jlong arg) {
326         LDKCVec_usizeZ arg_conv = *(LDKCVec_usizeZ*)arg;
327         return CVec_usizeZ_free(arg_conv);
328 }
329
330 JNIEXPORT jlong JNICALL C2TupleTxidu32Znew(JNIEnv * _env, jclass _b, jlong a, jint b) {
331         LDKThirtyTwoBytes a_conv = *(LDKThirtyTwoBytes*)a;
332         LDKC2Tuple_Txidu32Z* ret = malloc(sizeof(LDKC2Tuple_Txidu32Z));
333         *ret = C2Tuple_Txidu32Z_new(a_conv, b);
334         return (long)ret;
335 }
336
337 JNIEXPORT jlong JNICALL C2TupleScriptu64Znew(JNIEnv * _env, jclass _b, jlong a, jlong b) {
338         LDKCVec_u8Z a_conv = *(LDKCVec_u8Z*)a;
339         LDKC2Tuple_Scriptu64Z* ret = malloc(sizeof(LDKC2Tuple_Scriptu64Z));
340         *ret = C2Tuple_Scriptu64Z_new(a_conv, b);
341         return (long)ret;
342 }
343
344 JNIEXPORT jlong JNICALL C2Tupleu64u64Znew(JNIEnv * _env, jclass _b, jlong a, jlong b) {
345         LDKC2Tuple_u64u64Z* ret = malloc(sizeof(LDKC2Tuple_u64u64Z));
346         *ret = C2Tuple_u64u64Z_new(a, b);
347         return (long)ret;
348 }
349
350 JNIEXPORT jlong JNICALL C2TupleSignatureCVecSignatureZZnew(JNIEnv * _env, jclass _b, jlong a, jlong b) {
351         LDKSignature a_conv = *(LDKSignature*)a;
352         LDKCVec_SignatureZ b_conv = *(LDKCVec_SignatureZ*)b;
353         LDKC2Tuple_SignatureCVec_SignatureZZ* ret = malloc(sizeof(LDKC2Tuple_SignatureCVec_SignatureZZ));
354         *ret = C2Tuple_SignatureCVec_SignatureZZ_new(a_conv, b_conv);
355         return (long)ret;
356 }
357
358 JNIEXPORT jlong JNICALL CResultC2TupleSignatureCVecSignatureZZNoneZerr(JNIEnv * _env, jclass _b) {
359         LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ* ret = malloc(sizeof(LDKCResult_C2Tuple_SignatureCVec_SignatureZZNoneZ));
360         *ret = CResult_C2Tuple_SignatureCVec_SignatureZZNoneZ_err();
361         return (long)ret;
362 }
363
364 JNIEXPORT jlong JNICALL CResultSignatureNoneZerr(JNIEnv * _env, jclass _b) {
365         LDKCResult_SignatureNoneZ* ret = malloc(sizeof(LDKCResult_SignatureNoneZ));
366         *ret = CResult_SignatureNoneZ_err();
367         return (long)ret;
368 }
369
370 JNIEXPORT jlong JNICALL CResultCVecSignatureZNoneZerr(JNIEnv * _env, jclass _b) {
371         LDKCResult_CVec_SignatureZNoneZ* ret = malloc(sizeof(LDKCResult_CVec_SignatureZNoneZ));
372         *ret = CResult_CVec_SignatureZNoneZ_err();
373         return (long)ret;
374 }
375
376 JNIEXPORT jlong JNICALL C2TupleSecretKeyu832Znew(JNIEnv * _env, jclass _b, jlong a, jlong b) {
377         LDKSecretKey a_conv = *(LDKSecretKey*)a;
378         LDKThirtyTwoBytes b_conv = *(LDKThirtyTwoBytes*)b;
379         LDKC2Tuple_SecretKey_u832Z* ret = malloc(sizeof(LDKC2Tuple_SecretKey_u832Z));
380         *ret = C2Tuple_SecretKey_u832Z_new(a_conv, b_conv);
381         return (long)ret;
382 }
383
384 JNIEXPORT jlong JNICALL CResultNoneAPIErrorZgood(JNIEnv * _env, jclass _b) {
385         LDKCResult_NoneAPIErrorZ* ret = malloc(sizeof(LDKCResult_NoneAPIErrorZ));
386         *ret = CResult_NoneAPIErrorZ_good();
387         return (long)ret;
388 }
389
390 JNIEXPORT jlong JNICALL CResultNonePaymentSendFailureZgood(JNIEnv * _env, jclass _b) {
391         LDKCResult_NonePaymentSendFailureZ* ret = malloc(sizeof(LDKCResult_NonePaymentSendFailureZ));
392         *ret = CResult_NonePaymentSendFailureZ_good();
393         return (long)ret;
394 }
395
396 JNIEXPORT jlong JNICALL CResultNoneChannelMonitorUpdateErrZgood(JNIEnv * _env, jclass _b) {
397         LDKCResult_NoneChannelMonitorUpdateErrZ* ret = malloc(sizeof(LDKCResult_NoneChannelMonitorUpdateErrZ));
398         *ret = CResult_NoneChannelMonitorUpdateErrZ_good();
399         return (long)ret;
400 }
401
402 JNIEXPORT jlong JNICALL CResultNoneMonitorUpdateErrorZgood(JNIEnv * _env, jclass _b) {
403         LDKCResult_NoneMonitorUpdateErrorZ* ret = malloc(sizeof(LDKCResult_NoneMonitorUpdateErrorZ));
404         *ret = CResult_NoneMonitorUpdateErrorZ_good();
405         return (long)ret;
406 }
407
408 JNIEXPORT jlong JNICALL C2TupleOutPointScriptZnew(JNIEnv * _env, jclass _b, jlong a, jlong b) {
409         LDKOutPoint a_conv = *(LDKOutPoint*)a;
410         LDKCVec_u8Z b_conv = *(LDKCVec_u8Z*)b;
411         LDKC2Tuple_OutPointScriptZ* ret = malloc(sizeof(LDKC2Tuple_OutPointScriptZ));
412         *ret = C2Tuple_OutPointScriptZ_new(a_conv, b_conv);
413         return (long)ret;
414 }
415
416 JNIEXPORT jlong JNICALL C3TupleChannelAnnouncementChannelUpdateChannelUpdateZnew(JNIEnv * _env, jclass _b, jlong a, jlong b, jlong c) {
417         LDKChannelAnnouncement a_conv = *(LDKChannelAnnouncement*)a;
418         LDKChannelUpdate b_conv = *(LDKChannelUpdate*)b;
419         LDKChannelUpdate c_conv = *(LDKChannelUpdate*)c;
420         LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ* ret = malloc(sizeof(LDKC3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ));
421         *ret = C3Tuple_ChannelAnnouncementChannelUpdateChannelUpdateZ_new(a_conv, b_conv, c_conv);
422         return (long)ret;
423 }
424
425 JNIEXPORT jlong JNICALL CResultNonePeerHandleErrorZgood(JNIEnv * _env, jclass _b) {
426         LDKCResult_NonePeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_NonePeerHandleErrorZ));
427         *ret = CResult_NonePeerHandleErrorZ_good();
428         return (long)ret;
429 }
430
431 JNIEXPORT void JNICALL Eventfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
432         LDKEvent this_ptr_conv = *(LDKEvent*)this_ptr;
433         return Event_free(this_ptr_conv);
434 }
435
436 JNIEXPORT void JNICALL MessageSendEventfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
437         LDKMessageSendEvent this_ptr_conv = *(LDKMessageSendEvent*)this_ptr;
438         return MessageSendEvent_free(this_ptr_conv);
439 }
440
441 JNIEXPORT void JNICALL MessageSendEventsProviderfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
442         LDKMessageSendEventsProvider this_ptr_conv = *(LDKMessageSendEventsProvider*)this_ptr;
443         return MessageSendEventsProvider_free(this_ptr_conv);
444 }
445
446 JNIEXPORT void JNICALL EventsProviderfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
447         LDKEventsProvider this_ptr_conv = *(LDKEventsProvider*)this_ptr;
448         return EventsProvider_free(this_ptr_conv);
449 }
450
451 JNIEXPORT void JNICALL APIErrorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
452         LDKAPIError this_ptr_conv = *(LDKAPIError*)this_ptr;
453         return APIError_free(this_ptr_conv);
454 }
455
456 JNIEXPORT jlong JNICALL Levelmax(JNIEnv * _env, jclass _b) {
457         LDKLevel* ret = malloc(sizeof(LDKLevel));
458         *ret = Level_max();
459         return (long)ret;
460 }
461
462 JNIEXPORT void JNICALL Loggerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
463         LDKLogger this_ptr_conv = *(LDKLogger*)this_ptr;
464         return Logger_free(this_ptr_conv);
465 }
466
467 JNIEXPORT void JNICALL ChannelHandshakeConfigfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
468         LDKChannelHandshakeConfig this_ptr_conv = *(LDKChannelHandshakeConfig*)this_ptr;
469         return ChannelHandshakeConfig_free(this_ptr_conv);
470 }
471
472 JNIEXPORT jint JNICALL ChannelHandshakeConfiggetminimumdepth(JNIEnv * _env, jclass _b, jlong this_ptr) {
473         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
474         return ChannelHandshakeConfig_get_minimum_depth(this_ptr_conv);
475 }
476
477 JNIEXPORT void JNICALL ChannelHandshakeConfigsetminimumdepth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
478         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
479         return ChannelHandshakeConfig_set_minimum_depth(this_ptr_conv, val);
480 }
481
482 JNIEXPORT jlong JNICALL ChannelHandshakeConfiggetourtoselfdelay(JNIEnv * _env, jclass _b, jlong this_ptr) {
483         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
484         uint16_t* ret = malloc(sizeof(uint16_t));
485         *ret = ChannelHandshakeConfig_get_our_to_self_delay(this_ptr_conv);
486         return (long)ret;
487 }
488
489 JNIEXPORT void JNICALL ChannelHandshakeConfigsetourtoselfdelay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
490         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
491         uint16_t val_conv = *(uint16_t*)val;
492         return ChannelHandshakeConfig_set_our_to_self_delay(this_ptr_conv, val_conv);
493 }
494
495 JNIEXPORT jlong JNICALL ChannelHandshakeConfiggetourhtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
496         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
497         return ChannelHandshakeConfig_get_our_htlc_minimum_msat(this_ptr_conv);
498 }
499
500 JNIEXPORT void JNICALL ChannelHandshakeConfigsetourhtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
501         LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
502         return ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr_conv, val);
503 }
504
505 JNIEXPORT jlong JNICALL ChannelHandshakeConfignew(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jlong our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
506         uint16_t our_to_self_delay_arg_conv = *(uint16_t*)our_to_self_delay_arg;
507         LDKChannelHandshakeConfig* ret = malloc(sizeof(LDKChannelHandshakeConfig));
508         *ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg_conv, our_htlc_minimum_msat_arg);
509         return (long)ret;
510 }
511
512 JNIEXPORT jlong JNICALL ChannelHandshakeConfigdefault(JNIEnv * _env, jclass _b) {
513         LDKChannelHandshakeConfig* ret = malloc(sizeof(LDKChannelHandshakeConfig));
514         *ret = ChannelHandshakeConfig_default();
515         return (long)ret;
516 }
517
518 JNIEXPORT void JNICALL ChannelHandshakeLimitsfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
519         LDKChannelHandshakeLimits this_ptr_conv = *(LDKChannelHandshakeLimits*)this_ptr;
520         return ChannelHandshakeLimits_free(this_ptr_conv);
521 }
522
523 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetminfundingsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
524         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
525         return ChannelHandshakeLimits_get_min_funding_satoshis(this_ptr_conv);
526 }
527
528 JNIEXPORT void JNICALL ChannelHandshakeLimitssetminfundingsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
529         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
530         return ChannelHandshakeLimits_set_min_funding_satoshis(this_ptr_conv, val);
531 }
532
533 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetmaxhtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
534         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
535         return ChannelHandshakeLimits_get_max_htlc_minimum_msat(this_ptr_conv);
536 }
537
538 JNIEXPORT void JNICALL ChannelHandshakeLimitssetmaxhtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
539         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
540         return ChannelHandshakeLimits_set_max_htlc_minimum_msat(this_ptr_conv, val);
541 }
542
543 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetminmaxhtlcvalueinflightmsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
544         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
545         return ChannelHandshakeLimits_get_min_max_htlc_value_in_flight_msat(this_ptr_conv);
546 }
547
548 JNIEXPORT void JNICALL ChannelHandshakeLimitssetminmaxhtlcvalueinflightmsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
549         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
550         return ChannelHandshakeLimits_set_min_max_htlc_value_in_flight_msat(this_ptr_conv, val);
551 }
552
553 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetmaxchannelreservesatoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
554         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
555         return ChannelHandshakeLimits_get_max_channel_reserve_satoshis(this_ptr_conv);
556 }
557
558 JNIEXPORT void JNICALL ChannelHandshakeLimitssetmaxchannelreservesatoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
559         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
560         return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr_conv, val);
561 }
562
563 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetminmaxacceptedhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
564         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
565         uint16_t* ret = malloc(sizeof(uint16_t));
566         *ret = ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr_conv);
567         return (long)ret;
568 }
569
570 JNIEXPORT void JNICALL ChannelHandshakeLimitssetminmaxacceptedhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
571         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
572         uint16_t val_conv = *(uint16_t*)val;
573         return ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr_conv, val_conv);
574 }
575
576 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetmindustlimitsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
577         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
578         return ChannelHandshakeLimits_get_min_dust_limit_satoshis(this_ptr_conv);
579 }
580
581 JNIEXPORT void JNICALL ChannelHandshakeLimitssetmindustlimitsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
582         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
583         return ChannelHandshakeLimits_set_min_dust_limit_satoshis(this_ptr_conv, val);
584 }
585
586 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgetmaxdustlimitsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
587         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
588         return ChannelHandshakeLimits_get_max_dust_limit_satoshis(this_ptr_conv);
589 }
590
591 JNIEXPORT void JNICALL ChannelHandshakeLimitssetmaxdustlimitsatoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
592         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
593         return ChannelHandshakeLimits_set_max_dust_limit_satoshis(this_ptr_conv, val);
594 }
595
596 JNIEXPORT jint JNICALL ChannelHandshakeLimitsgetmaxminimumdepth(JNIEnv * _env, jclass _b, jlong this_ptr) {
597         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
598         return ChannelHandshakeLimits_get_max_minimum_depth(this_ptr_conv);
599 }
600
601 JNIEXPORT void JNICALL ChannelHandshakeLimitssetmaxminimumdepth(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
602         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
603         return ChannelHandshakeLimits_set_max_minimum_depth(this_ptr_conv, val);
604 }
605
606 JNIEXPORT jboolean JNICALL ChannelHandshakeLimitsgetforceannouncedchannelpreference(JNIEnv * _env, jclass _b, jlong this_ptr) {
607         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
608         return ChannelHandshakeLimits_get_force_announced_channel_preference(this_ptr_conv);
609 }
610
611 JNIEXPORT void JNICALL ChannelHandshakeLimitssetforceannouncedchannelpreference(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
612         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
613         return ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr_conv, va);
614 }
615
616 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsgettheirtoselfdelay(JNIEnv * _env, jclass _b, jlong this_ptr) {
617         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
618         uint16_t* ret = malloc(sizeof(uint16_t));
619         *ret = ChannelHandshakeLimits_get_their_to_self_delay(this_ptr_conv);
620         return (long)ret;
621 }
622
623 JNIEXPORT void JNICALL ChannelHandshakeLimitssettheirtoselfdelay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
624         LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
625         uint16_t val_conv = *(uint16_t*)val;
626         return ChannelHandshakeLimits_set_their_to_self_delay(this_ptr_conv, val_conv);
627 }
628
629 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsnew(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, jlong 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, jlong their_to_self_delay_arg) {
630         uint16_t min_max_accepted_htlcs_arg_conv = *(uint16_t*)min_max_accepted_htlcs_arg;
631         uint16_t their_to_self_delay_arg_conv = *(uint16_t*)their_to_self_delay_arg;
632         LDKChannelHandshakeLimits* ret = malloc(sizeof(LDKChannelHandshakeLimits));
633         *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_conv, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg_conv);
634         return (long)ret;
635 }
636
637 JNIEXPORT jlong JNICALL ChannelHandshakeLimitsdefault(JNIEnv * _env, jclass _b) {
638         LDKChannelHandshakeLimits* ret = malloc(sizeof(LDKChannelHandshakeLimits));
639         *ret = ChannelHandshakeLimits_default();
640         return (long)ret;
641 }
642
643 JNIEXPORT void JNICALL ChannelConfigfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
644         LDKChannelConfig this_ptr_conv = *(LDKChannelConfig*)this_ptr;
645         return ChannelConfig_free(this_ptr_conv);
646 }
647
648 JNIEXPORT jint JNICALL ChannelConfiggetfeeproportionalmillionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
649         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
650         return ChannelConfig_get_fee_proportional_millionths(this_ptr_conv);
651 }
652
653 JNIEXPORT void JNICALL ChannelConfigsetfeeproportionalmillionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
654         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
655         return ChannelConfig_set_fee_proportional_millionths(this_ptr_conv, val);
656 }
657
658 JNIEXPORT jboolean JNICALL ChannelConfiggetannouncedchannel(JNIEnv * _env, jclass _b, jlong this_ptr) {
659         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
660         return ChannelConfig_get_announced_channel(this_ptr_conv);
661 }
662
663 JNIEXPORT void JNICALL ChannelConfigsetannouncedchannel(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
664         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
665         return ChannelConfig_set_announced_channel(this_ptr_conv, va);
666 }
667
668 JNIEXPORT jboolean JNICALL ChannelConfiggetcommitupfrontshutdownpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
669         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
670         return ChannelConfig_get_commit_upfront_shutdown_pubkey(this_ptr_conv);
671 }
672
673 JNIEXPORT void JNICALL ChannelConfigsetcommitupfrontshutdownpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
674         LDKChannelConfig* this_ptr_conv = (LDKChannelConfig*)this_ptr;
675         return ChannelConfig_set_commit_upfront_shutdown_pubkey(this_ptr_conv, va);
676 }
677
678 JNIEXPORT jlong JNICALL ChannelConfignew(JNIEnv * _env, jclass _b, jint fee_proportional_millionths_arg, jboolean announced_channel_arg, jboolean commit_upfront_shutdown_pubkey_arg) {
679         LDKChannelConfig* ret = malloc(sizeof(LDKChannelConfig));
680         *ret = ChannelConfig_new(fee_proportional_millionths_arg, announced_channel_arg, commit_upfront_shutdown_pubkey_arg);
681         return (long)ret;
682 }
683
684 JNIEXPORT jlong JNICALL ChannelConfigdefault(JNIEnv * _env, jclass _b) {
685         LDKChannelConfig* ret = malloc(sizeof(LDKChannelConfig));
686         *ret = ChannelConfig_default();
687         return (long)ret;
688 }
689
690 JNIEXPORT jlong JNICALL ChannelConfigwrite(JNIEnv * _env, jclass _b, jlong obj) {
691         LDKChannelConfig* obj_conv = (LDKChannelConfig*)obj;
692         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
693         *ret = ChannelConfig_write(obj_conv);
694         return (long)ret;
695 }
696
697 JNIEXPORT jlong JNICALL ChannelConfigread(JNIEnv * _env, jclass _b, jlong ser) {
698         LDKu8slice ser_conv = *(LDKu8slice*)ser;
699         LDKChannelConfig* ret = malloc(sizeof(LDKChannelConfig));
700         *ret = ChannelConfig_read(ser_conv);
701         return (long)ret;
702 }
703
704 JNIEXPORT void JNICALL UserConfigfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
705         LDKUserConfig this_ptr_conv = *(LDKUserConfig*)this_ptr;
706         return UserConfig_free(this_ptr_conv);
707 }
708
709 JNIEXPORT jlong JNICALL UserConfiggetownchannelconfig(JNIEnv * _env, jclass _b, jlong this_ptr) {
710         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
711         LDKChannelHandshakeConfig* ret = malloc(sizeof(LDKChannelHandshakeConfig));
712         *ret = UserConfig_get_own_channel_config(this_ptr_conv);
713         return (long)ret;
714 }
715
716 JNIEXPORT void JNICALL UserConfigsetownchannelconfig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
717         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
718         LDKChannelHandshakeConfig val_conv = *(LDKChannelHandshakeConfig*)val;
719         return UserConfig_set_own_channel_config(this_ptr_conv, val_conv);
720 }
721
722 JNIEXPORT jlong JNICALL UserConfiggetpeerchannelconfiglimits(JNIEnv * _env, jclass _b, jlong this_ptr) {
723         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
724         LDKChannelHandshakeLimits* ret = malloc(sizeof(LDKChannelHandshakeLimits));
725         *ret = UserConfig_get_peer_channel_config_limits(this_ptr_conv);
726         return (long)ret;
727 }
728
729 JNIEXPORT void JNICALL UserConfigsetpeerchannelconfiglimits(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
730         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
731         LDKChannelHandshakeLimits val_conv = *(LDKChannelHandshakeLimits*)val;
732         return UserConfig_set_peer_channel_config_limits(this_ptr_conv, val_conv);
733 }
734
735 JNIEXPORT jlong JNICALL UserConfiggetchanneloptions(JNIEnv * _env, jclass _b, jlong this_ptr) {
736         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
737         LDKChannelConfig* ret = malloc(sizeof(LDKChannelConfig));
738         *ret = UserConfig_get_channel_options(this_ptr_conv);
739         return (long)ret;
740 }
741
742 JNIEXPORT void JNICALL UserConfigsetchanneloptions(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
743         LDKUserConfig* this_ptr_conv = (LDKUserConfig*)this_ptr;
744         LDKChannelConfig val_conv = *(LDKChannelConfig*)val;
745         return UserConfig_set_channel_options(this_ptr_conv, val_conv);
746 }
747
748 JNIEXPORT jlong JNICALL UserConfignew(JNIEnv * _env, jclass _b, jlong own_channel_config_arg, jlong peer_channel_config_limits_arg, jlong channel_options_arg) {
749         LDKChannelHandshakeConfig own_channel_config_arg_conv = *(LDKChannelHandshakeConfig*)own_channel_config_arg;
750         LDKChannelHandshakeLimits peer_channel_config_limits_arg_conv = *(LDKChannelHandshakeLimits*)peer_channel_config_limits_arg;
751         LDKChannelConfig channel_options_arg_conv = *(LDKChannelConfig*)channel_options_arg;
752         LDKUserConfig* ret = malloc(sizeof(LDKUserConfig));
753         *ret = UserConfig_new(own_channel_config_arg_conv, peer_channel_config_limits_arg_conv, channel_options_arg_conv);
754         return (long)ret;
755 }
756
757 JNIEXPORT jlong JNICALL UserConfigdefault(JNIEnv * _env, jclass _b) {
758         LDKUserConfig* ret = malloc(sizeof(LDKUserConfig));
759         *ret = UserConfig_default();
760         return (long)ret;
761 }
762
763 JNIEXPORT void JNICALL ChainWatchInterfacefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
764         LDKChainWatchInterface this_ptr_conv = *(LDKChainWatchInterface*)this_ptr;
765         return ChainWatchInterface_free(this_ptr_conv);
766 }
767
768 JNIEXPORT void JNICALL BroadcasterInterfacefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
769         LDKBroadcasterInterface this_ptr_conv = *(LDKBroadcasterInterface*)this_ptr;
770         return BroadcasterInterface_free(this_ptr_conv);
771 }
772
773 JNIEXPORT void JNICALL ChainListenerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
774         LDKChainListener this_ptr_conv = *(LDKChainListener*)this_ptr;
775         return ChainListener_free(this_ptr_conv);
776 }
777
778 JNIEXPORT void JNICALL FeeEstimatorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
779         LDKFeeEstimator this_ptr_conv = *(LDKFeeEstimator*)this_ptr;
780         return FeeEstimator_free(this_ptr_conv);
781 }
782
783 JNIEXPORT void JNICALL ChainWatchedUtilfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
784         LDKChainWatchedUtil this_ptr_conv = *(LDKChainWatchedUtil*)this_ptr;
785         return ChainWatchedUtil_free(this_ptr_conv);
786 }
787
788 JNIEXPORT jlong JNICALL ChainWatchedUtilnew(JNIEnv * _env, jclass _b) {
789         LDKChainWatchedUtil* ret = malloc(sizeof(LDKChainWatchedUtil));
790         *ret = ChainWatchedUtil_new();
791         return (long)ret;
792 }
793
794 JNIEXPORT jboolean JNICALL ChainWatchedUtilregistertx(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray txid, jlong script_pub_key) {
795         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
796         unsigned char txid_arr[32];
797         (*_env)->GetByteArrayRegion (_env, txid, 0, 32, txid_arr);
798         unsigned char (*txid_ref)[32] = &txid_arr;
799         LDKu8slice script_pub_key_conv = *(LDKu8slice*)script_pub_key;
800         return ChainWatchedUtil_register_tx(this_arg_conv, txid_ref, script_pub_key_conv);
801 }
802
803 JNIEXPORT jboolean JNICALL ChainWatchedUtilregisteroutpoint(JNIEnv * _env, jclass _b, jlong this_arg, jlong outpoint, jlong _script_pub_key) {
804         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
805         LDKC2Tuple_Txidu32Z outpoint_conv = *(LDKC2Tuple_Txidu32Z*)outpoint;
806         LDKu8slice _script_pub_key_conv = *(LDKu8slice*)_script_pub_key;
807         return ChainWatchedUtil_register_outpoint(this_arg_conv, outpoint_conv, _script_pub_key_conv);
808 }
809
810 JNIEXPORT jboolean JNICALL ChainWatchedUtilwatchall(JNIEnv * _env, jclass _b, jlong this_arg) {
811         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
812         return ChainWatchedUtil_watch_all(this_arg_conv);
813 }
814
815 JNIEXPORT jboolean JNICALL ChainWatchedUtildoesmatchtx(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
816         LDKChainWatchedUtil* this_arg_conv = (LDKChainWatchedUtil*)this_arg;
817         LDKTransaction tx_conv = *(LDKTransaction*)tx;
818         return ChainWatchedUtil_does_match_tx(this_arg_conv, tx_conv);
819 }
820
821 JNIEXPORT void JNICALL BlockNotifierfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
822         LDKBlockNotifier this_ptr_conv = *(LDKBlockNotifier*)this_ptr;
823         return BlockNotifier_free(this_ptr_conv);
824 }
825
826 JNIEXPORT jlong JNICALL BlockNotifiernew(JNIEnv * _env, jclass _b, jlong chain_monitor) {
827         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
828         LDKBlockNotifier* ret = malloc(sizeof(LDKBlockNotifier));
829         *ret = BlockNotifier_new(chain_monitor_conv);
830         return (long)ret;
831 }
832
833 JNIEXPORT void JNICALL BlockNotifierregisterlistener(JNIEnv * _env, jclass _b, jlong this_arg, jlong listener) {
834         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
835         LDKChainListener listener_conv = *(LDKChainListener*)listener;
836         return BlockNotifier_register_listener(this_arg_conv, listener_conv);
837 }
838
839 JNIEXPORT void JNICALL BlockNotifierblockconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong block, jint heigh) {
840         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
841         LDKu8slice block_conv = *(LDKu8slice*)block;
842         return BlockNotifier_block_connected(this_arg_conv, block_conv, heigh);
843 }
844
845 JNIEXPORT jboolean JNICALL BlockNotifierblockconnectedchecked(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint heigh, jlong txn_matched, jlong indexes_of_txn_matched) {
846         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
847         unsigned char header_arr[80];
848         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
849         unsigned char (*header_ref)[80] = &header_arr;
850         LDKCTransactionSlice txn_matched_conv = *(LDKCTransactionSlice*)txn_matched;
851         LDKusizeslice indexes_of_txn_matched_conv = *(LDKusizeslice*)indexes_of_txn_matched;
852         return BlockNotifier_block_connected_checked(this_arg_conv, header_ref, heigh, txn_matched_conv, indexes_of_txn_matched_conv);
853 }
854
855 JNIEXPORT void JNICALL BlockNotifierblockdisconnected(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray header, jint disconnected_heigh) {
856         LDKBlockNotifier* this_arg_conv = (LDKBlockNotifier*)this_arg;
857         unsigned char header_arr[80];
858         (*_env)->GetByteArrayRegion (_env, header, 0, 80, header_arr);
859         unsigned char (*header_ref)[80] = &header_arr;
860         return BlockNotifier_block_disconnected(this_arg_conv, header_ref, disconnected_heigh);
861 }
862
863 JNIEXPORT void JNICALL ChainWatchInterfaceUtilfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
864         LDKChainWatchInterfaceUtil this_ptr_conv = *(LDKChainWatchInterfaceUtil*)this_ptr;
865         return ChainWatchInterfaceUtil_free(this_ptr_conv);
866 }
867
868 JNIEXPORT jlong JNICALL ChainWatchInterfaceUtilasChainWatchInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
869         LDKChainWatchInterfaceUtil* this_arg_conv = (LDKChainWatchInterfaceUtil*)this_arg;
870         LDKChainWatchInterface* ret = malloc(sizeof(LDKChainWatchInterface));
871         *ret = ChainWatchInterfaceUtil_as_ChainWatchInterface(this_arg_conv);
872         return (long)ret;
873 }
874
875 JNIEXPORT jlong JNICALL ChainWatchInterfaceUtilnew(JNIEnv * _env, jclass _b, jlong network) {
876         LDKNetwork network_conv = *(LDKNetwork*)network;
877         LDKChainWatchInterfaceUtil* ret = malloc(sizeof(LDKChainWatchInterfaceUtil));
878         *ret = ChainWatchInterfaceUtil_new(network_conv);
879         return (long)ret;
880 }
881
882 JNIEXPORT jboolean JNICALL ChainWatchInterfaceUtildoesmatchtx(JNIEnv * _env, jclass _b, jlong this_arg, jlong tx) {
883         LDKChainWatchInterfaceUtil* this_arg_conv = (LDKChainWatchInterfaceUtil*)this_arg;
884         LDKTransaction tx_conv = *(LDKTransaction*)tx;
885         return ChainWatchInterfaceUtil_does_match_tx(this_arg_conv, tx_conv);
886 }
887
888 JNIEXPORT void JNICALL OutPointfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
889         LDKOutPoint this_ptr_conv = *(LDKOutPoint*)this_ptr;
890         return OutPoint_free(this_ptr_conv);
891 }
892
893 JNIEXPORT jbyteArray  JNICALL OutPointgettxid(JNIEnv * _env, jclass _b, jlong this_ptr) {
894         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
895         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
896         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *OutPoint_get_txid(this_ptr_conv));
897         return ret_arr;
898 }
899
900 JNIEXPORT void JNICALL OutPointsettxid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
901         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
902         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
903         return OutPoint_set_txid(this_ptr_conv, val_conv);
904 }
905
906 JNIEXPORT jlong JNICALL OutPointgetindex(JNIEnv * _env, jclass _b, jlong this_ptr) {
907         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
908         uint16_t* ret = malloc(sizeof(uint16_t));
909         *ret = OutPoint_get_index(this_ptr_conv);
910         return (long)ret;
911 }
912
913 JNIEXPORT void JNICALL OutPointsetindex(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
914         LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
915         uint16_t val_conv = *(uint16_t*)val;
916         return OutPoint_set_index(this_ptr_conv, val_conv);
917 }
918
919 JNIEXPORT jlong JNICALL OutPointnew(JNIEnv * _env, jclass _b, jlong txid_arg, jlong index_arg) {
920         LDKThirtyTwoBytes txid_arg_conv = *(LDKThirtyTwoBytes*)txid_arg;
921         uint16_t index_arg_conv = *(uint16_t*)index_arg;
922         LDKOutPoint* ret = malloc(sizeof(LDKOutPoint));
923         *ret = OutPoint_new(txid_arg_conv, index_arg_conv);
924         return (long)ret;
925 }
926
927 JNIEXPORT jlong JNICALL OutPointtochannelid(JNIEnv * _env, jclass _b, jlong this_arg) {
928         LDKOutPoint* this_arg_conv = (LDKOutPoint*)this_arg;
929         LDKThirtyTwoBytes* ret = malloc(sizeof(LDKThirtyTwoBytes));
930         *ret = OutPoint_to_channel_id(this_arg_conv);
931         return (long)ret;
932 }
933
934 JNIEXPORT jlong JNICALL OutPointwrite(JNIEnv * _env, jclass _b, jlong obj) {
935         LDKOutPoint* obj_conv = (LDKOutPoint*)obj;
936         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
937         *ret = OutPoint_write(obj_conv);
938         return (long)ret;
939 }
940
941 JNIEXPORT jlong JNICALL OutPointread(JNIEnv * _env, jclass _b, jlong ser) {
942         LDKu8slice ser_conv = *(LDKu8slice*)ser;
943         LDKOutPoint* ret = malloc(sizeof(LDKOutPoint));
944         *ret = OutPoint_read(ser_conv);
945         return (long)ret;
946 }
947
948 JNIEXPORT void JNICALL SpendableOutputDescriptorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
949         LDKSpendableOutputDescriptor this_ptr_conv = *(LDKSpendableOutputDescriptor*)this_ptr;
950         return SpendableOutputDescriptor_free(this_ptr_conv);
951 }
952
953 JNIEXPORT jlong JNICALL SpendableOutputDescriptorwrite(JNIEnv * _env, jclass _b, jlong obj) {
954         LDKSpendableOutputDescriptor* obj_conv = (LDKSpendableOutputDescriptor*)obj;
955         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
956         *ret = SpendableOutputDescriptor_write(obj_conv);
957         return (long)ret;
958 }
959
960 JNIEXPORT jlong JNICALL SpendableOutputDescriptorread(JNIEnv * _env, jclass _b, jlong ser) {
961         LDKu8slice ser_conv = *(LDKu8slice*)ser;
962         LDKSpendableOutputDescriptor* ret = malloc(sizeof(LDKSpendableOutputDescriptor));
963         *ret = SpendableOutputDescriptor_read(ser_conv);
964         return (long)ret;
965 }
966
967 JNIEXPORT void JNICALL ChannelKeysfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
968         LDKChannelKeys this_ptr_conv = *(LDKChannelKeys*)this_ptr;
969         return ChannelKeys_free(this_ptr_conv);
970 }
971
972 JNIEXPORT void JNICALL KeysInterfacefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
973         LDKKeysInterface this_ptr_conv = *(LDKKeysInterface*)this_ptr;
974         return KeysInterface_free(this_ptr_conv);
975 }
976
977 JNIEXPORT void JNICALL InMemoryChannelKeysfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
978         LDKInMemoryChannelKeys this_ptr_conv = *(LDKInMemoryChannelKeys*)this_ptr;
979         return InMemoryChannelKeys_free(this_ptr_conv);
980 }
981
982 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgetfundingkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
983         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
984         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
985         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_funding_key(this_ptr_conv));
986         return ret_arr;
987 }
988
989 JNIEXPORT void JNICALL InMemoryChannelKeyssetfundingkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
990         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
991         LDKSecretKey val_conv = *(LDKSecretKey*)val;
992         return InMemoryChannelKeys_set_funding_key(this_ptr_conv, val_conv);
993 }
994
995 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgetrevocationbasekey(JNIEnv * _env, jclass _b, jlong this_ptr) {
996         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
997         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
998         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_revocation_base_key(this_ptr_conv));
999         return ret_arr;
1000 }
1001
1002 JNIEXPORT void JNICALL InMemoryChannelKeyssetrevocationbasekey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1003         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1004         LDKSecretKey val_conv = *(LDKSecretKey*)val;
1005         return InMemoryChannelKeys_set_revocation_base_key(this_ptr_conv, val_conv);
1006 }
1007
1008 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgetpaymentkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
1009         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1010         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1011         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_payment_key(this_ptr_conv));
1012         return ret_arr;
1013 }
1014
1015 JNIEXPORT void JNICALL InMemoryChannelKeyssetpaymentkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1016         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1017         LDKSecretKey val_conv = *(LDKSecretKey*)val;
1018         return InMemoryChannelKeys_set_payment_key(this_ptr_conv, val_conv);
1019 }
1020
1021 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgetdelayedpaymentbasekey(JNIEnv * _env, jclass _b, jlong this_ptr) {
1022         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1023         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1024         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_delayed_payment_base_key(this_ptr_conv));
1025         return ret_arr;
1026 }
1027
1028 JNIEXPORT void JNICALL InMemoryChannelKeyssetdelayedpaymentbasekey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1029         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1030         LDKSecretKey val_conv = *(LDKSecretKey*)val;
1031         return InMemoryChannelKeys_set_delayed_payment_base_key(this_ptr_conv, val_conv);
1032 }
1033
1034 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgethtlcbasekey(JNIEnv * _env, jclass _b, jlong this_ptr) {
1035         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1036         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1037         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_htlc_base_key(this_ptr_conv));
1038         return ret_arr;
1039 }
1040
1041 JNIEXPORT void JNICALL InMemoryChannelKeyssethtlcbasekey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1042         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1043         LDKSecretKey val_conv = *(LDKSecretKey*)val;
1044         return InMemoryChannelKeys_set_htlc_base_key(this_ptr_conv, val_conv);
1045 }
1046
1047 JNIEXPORT jbyteArray  JNICALL InMemoryChannelKeysgetcommitmentseed(JNIEnv * _env, jclass _b, jlong this_ptr) {
1048         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1049         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1050         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *InMemoryChannelKeys_get_commitment_seed(this_ptr_conv));
1051         return ret_arr;
1052 }
1053
1054 JNIEXPORT void JNICALL InMemoryChannelKeyssetcommitmentseed(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1055         LDKInMemoryChannelKeys* this_ptr_conv = (LDKInMemoryChannelKeys*)this_ptr;
1056         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
1057         return InMemoryChannelKeys_set_commitment_seed(this_ptr_conv, val_conv);
1058 }
1059
1060 JNIEXPORT jlong JNICALL InMemoryChannelKeysnew(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) {
1061         LDKSecretKey funding_key_conv = *(LDKSecretKey*)funding_key;
1062         LDKSecretKey revocation_base_key_conv = *(LDKSecretKey*)revocation_base_key;
1063         LDKSecretKey payment_key_conv = *(LDKSecretKey*)payment_key;
1064         LDKSecretKey delayed_payment_base_key_conv = *(LDKSecretKey*)delayed_payment_base_key;
1065         LDKSecretKey htlc_base_key_conv = *(LDKSecretKey*)htlc_base_key;
1066         LDKThirtyTwoBytes commitment_seed_conv = *(LDKThirtyTwoBytes*)commitment_seed;
1067         LDKC2Tuple_u64u64Z key_derivation_params_conv = *(LDKC2Tuple_u64u64Z*)key_derivation_params;
1068         LDKInMemoryChannelKeys* ret = malloc(sizeof(LDKInMemoryChannelKeys));
1069         *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);
1070         return (long)ret;
1071 }
1072
1073 JNIEXPORT jlong JNICALL InMemoryChannelKeysasChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
1074         LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
1075         LDKChannelKeys* ret = malloc(sizeof(LDKChannelKeys));
1076         *ret = InMemoryChannelKeys_as_ChannelKeys(this_arg_conv);
1077         return (long)ret;
1078 }
1079
1080 JNIEXPORT jlong JNICALL InMemoryChannelKeyswrite(JNIEnv * _env, jclass _b, jlong obj) {
1081         LDKInMemoryChannelKeys* obj_conv = (LDKInMemoryChannelKeys*)obj;
1082         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1083         *ret = InMemoryChannelKeys_write(obj_conv);
1084         return (long)ret;
1085 }
1086
1087 JNIEXPORT jlong JNICALL InMemoryChannelKeysread(JNIEnv * _env, jclass _b, jlong ser) {
1088         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1089         LDKInMemoryChannelKeys* ret = malloc(sizeof(LDKInMemoryChannelKeys));
1090         *ret = InMemoryChannelKeys_read(ser_conv);
1091         return (long)ret;
1092 }
1093
1094 JNIEXPORT void JNICALL KeysManagerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1095         LDKKeysManager this_ptr_conv = *(LDKKeysManager*)this_ptr;
1096         return KeysManager_free(this_ptr_conv);
1097 }
1098
1099 JNIEXPORT jlong JNICALL KeysManagernew(JNIEnv * _env, jclass _b, jbyteArray seed, jlong network, jlong starting_time_secs, jint starting_time_nanos) {
1100         unsigned char seed_arr[32];
1101         (*_env)->GetByteArrayRegion (_env, seed, 0, 32, seed_arr);
1102         unsigned char (*seed_ref)[32] = &seed_arr;
1103         LDKNetwork network_conv = *(LDKNetwork*)network;
1104         LDKKeysManager* ret = malloc(sizeof(LDKKeysManager));
1105         *ret = KeysManager_new(seed_ref, network_conv, starting_time_secs, starting_time_nanos);
1106         return (long)ret;
1107 }
1108
1109 JNIEXPORT jlong JNICALL KeysManagerderivechannelkeys(JNIEnv * _env, jclass _b, jlong this_arg, jlong channel_value_satoshis, jlong params_1, jlong params_2) {
1110         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
1111         LDKInMemoryChannelKeys* ret = malloc(sizeof(LDKInMemoryChannelKeys));
1112         *ret = KeysManager_derive_channel_keys(this_arg_conv, channel_value_satoshis, params_1, params_2);
1113         return (long)ret;
1114 }
1115
1116 JNIEXPORT jlong JNICALL KeysManagerasKeysInterface(JNIEnv * _env, jclass _b, jlong this_arg) {
1117         LDKKeysManager* this_arg_conv = (LDKKeysManager*)this_arg;
1118         LDKKeysInterface* ret = malloc(sizeof(LDKKeysInterface));
1119         *ret = KeysManager_as_KeysInterface(this_arg_conv);
1120         return (long)ret;
1121 }
1122
1123 JNIEXPORT void JNICALL ChannelManagerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1124         LDKChannelManager this_ptr_conv = *(LDKChannelManager*)this_ptr;
1125         return ChannelManager_free(this_ptr_conv);
1126 }
1127
1128 JNIEXPORT void JNICALL ChannelDetailsfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1129         LDKChannelDetails this_ptr_conv = *(LDKChannelDetails*)this_ptr;
1130         return ChannelDetails_free(this_ptr_conv);
1131 }
1132
1133 JNIEXPORT jbyteArray  JNICALL ChannelDetailsgetchannelid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1134         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1135         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1136         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *ChannelDetails_get_channel_id(this_ptr_conv));
1137         return ret_arr;
1138 }
1139
1140 JNIEXPORT void JNICALL ChannelDetailssetchannelid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1141         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1142         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
1143         return ChannelDetails_set_channel_id(this_ptr_conv, val_conv);
1144 }
1145
1146 JNIEXPORT jlong JNICALL ChannelDetailsgetremotenetworkid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1147         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1148         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1149         *ret = ChannelDetails_get_remote_network_id(this_ptr_conv);
1150         return (long)ret;
1151 }
1152
1153 JNIEXPORT void JNICALL ChannelDetailssetremotenetworkid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1154         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1155         LDKPublicKey val_conv = *(LDKPublicKey*)val;
1156         return ChannelDetails_set_remote_network_id(this_ptr_conv, val_conv);
1157 }
1158
1159 JNIEXPORT jlong JNICALL ChannelDetailsgetcounterpartyfeatures(JNIEnv * _env, jclass _b, jlong this_ptr) {
1160         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1161         LDKInitFeatures* ret = malloc(sizeof(LDKInitFeatures));
1162         *ret = ChannelDetails_get_counterparty_features(this_ptr_conv);
1163         return (long)ret;
1164 }
1165
1166 JNIEXPORT void JNICALL ChannelDetailssetcounterpartyfeatures(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1167         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1168         LDKInitFeatures val_conv = *(LDKInitFeatures*)val;
1169         return ChannelDetails_set_counterparty_features(this_ptr_conv, val_conv);
1170 }
1171
1172 JNIEXPORT jlong JNICALL ChannelDetailsgetchannelvaluesatoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
1173         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1174         return ChannelDetails_get_channel_value_satoshis(this_ptr_conv);
1175 }
1176
1177 JNIEXPORT void JNICALL ChannelDetailssetchannelvaluesatoshis(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1178         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1179         return ChannelDetails_set_channel_value_satoshis(this_ptr_conv, val);
1180 }
1181
1182 JNIEXPORT jlong JNICALL ChannelDetailsgetuserid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1183         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1184         return ChannelDetails_get_user_id(this_ptr_conv);
1185 }
1186
1187 JNIEXPORT void JNICALL ChannelDetailssetuserid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1188         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1189         return ChannelDetails_set_user_id(this_ptr_conv, val);
1190 }
1191
1192 JNIEXPORT jlong JNICALL ChannelDetailsgetoutboundcapacitymsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
1193         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1194         return ChannelDetails_get_outbound_capacity_msat(this_ptr_conv);
1195 }
1196
1197 JNIEXPORT void JNICALL ChannelDetailssetoutboundcapacitymsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1198         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1199         return ChannelDetails_set_outbound_capacity_msat(this_ptr_conv, val);
1200 }
1201
1202 JNIEXPORT jlong JNICALL ChannelDetailsgetinboundcapacitymsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
1203         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1204         return ChannelDetails_get_inbound_capacity_msat(this_ptr_conv);
1205 }
1206
1207 JNIEXPORT void JNICALL ChannelDetailssetinboundcapacitymsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1208         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1209         return ChannelDetails_set_inbound_capacity_msat(this_ptr_conv, val);
1210 }
1211
1212 JNIEXPORT jboolean JNICALL ChannelDetailsgetislive(JNIEnv * _env, jclass _b, jlong this_ptr) {
1213         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1214         return ChannelDetails_get_is_live(this_ptr_conv);
1215 }
1216
1217 JNIEXPORT void JNICALL ChannelDetailssetislive(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
1218         LDKChannelDetails* this_ptr_conv = (LDKChannelDetails*)this_ptr;
1219         return ChannelDetails_set_is_live(this_ptr_conv, va);
1220 }
1221
1222 JNIEXPORT void JNICALL PaymentSendFailurefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1223         LDKPaymentSendFailure this_ptr_conv = *(LDKPaymentSendFailure*)this_ptr;
1224         return PaymentSendFailure_free(this_ptr_conv);
1225 }
1226
1227 JNIEXPORT jlong JNICALL ChannelManagernew(JNIEnv * _env, jclass _b, jlong network, jlong fee_est, jlong monitor, jlong tx_broadcaster, jlong logger, jlong keys_manager, jlong config, jlong current_blockchain_height) {
1228         LDKNetwork network_conv = *(LDKNetwork*)network;
1229         LDKFeeEstimator fee_est_conv = *(LDKFeeEstimator*)fee_est;
1230         LDKManyChannelMonitor monitor_conv = *(LDKManyChannelMonitor*)monitor;
1231         LDKBroadcasterInterface tx_broadcaster_conv = *(LDKBroadcasterInterface*)tx_broadcaster;
1232         LDKLogger logger_conv = *(LDKLogger*)logger;
1233         LDKKeysInterface keys_manager_conv = *(LDKKeysInterface*)keys_manager;
1234         LDKUserConfig config_conv = *(LDKUserConfig*)config;
1235         uintptr_t current_blockchain_height_conv = *(uintptr_t*)current_blockchain_height;
1236         LDKChannelManager* ret = malloc(sizeof(LDKChannelManager));
1237         *ret = ChannelManager_new(network_conv, fee_est_conv, monitor_conv, tx_broadcaster_conv, logger_conv, keys_manager_conv, config_conv, current_blockchain_height_conv);
1238         return (long)ret;
1239 }
1240
1241 JNIEXPORT jlong JNICALL ChannelManagercreatechannel(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_network_key, jlong channel_value_satoshis, jlong push_msa, jlong ser_id, jlong override_config) {
1242         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1243         LDKPublicKey their_network_key_conv = *(LDKPublicKey*)their_network_key;
1244         LDKUserConfig override_config_conv = *(LDKUserConfig*)override_config;
1245         LDKCResult_NoneAPIErrorZ* ret = malloc(sizeof(LDKCResult_NoneAPIErrorZ));
1246         *ret = ChannelManager_create_channel(this_arg_conv, their_network_key_conv, channel_value_satoshis, push_msa, ser_id, override_config_conv);
1247         return (long)ret;
1248 }
1249
1250 JNIEXPORT jlong JNICALL ChannelManagerlistchannels(JNIEnv * _env, jclass _b, jlong this_arg) {
1251         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1252         LDKCVec_ChannelDetailsZ* ret = malloc(sizeof(LDKCVec_ChannelDetailsZ));
1253         *ret = ChannelManager_list_channels(this_arg_conv);
1254         return (long)ret;
1255 }
1256
1257 JNIEXPORT jlong JNICALL ChannelManagerlistusablechannels(JNIEnv * _env, jclass _b, jlong this_arg) {
1258         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1259         LDKCVec_ChannelDetailsZ* ret = malloc(sizeof(LDKCVec_ChannelDetailsZ));
1260         *ret = ChannelManager_list_usable_channels(this_arg_conv);
1261         return (long)ret;
1262 }
1263
1264 JNIEXPORT jlong JNICALL ChannelManagerclosechannel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
1265         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1266         unsigned char channel_id_arr[32];
1267         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
1268         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
1269         LDKCResult_NoneAPIErrorZ* ret = malloc(sizeof(LDKCResult_NoneAPIErrorZ));
1270         *ret = ChannelManager_close_channel(this_arg_conv, channel_id_ref);
1271         return (long)ret;
1272 }
1273
1274 JNIEXPORT void JNICALL ChannelManagerforceclosechannel(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray channel_id) {
1275         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1276         unsigned char channel_id_arr[32];
1277         (*_env)->GetByteArrayRegion (_env, channel_id, 0, 32, channel_id_arr);
1278         unsigned char (*channel_id_ref)[32] = &channel_id_arr;
1279         return ChannelManager_force_close_channel(this_arg_conv, channel_id_ref);
1280 }
1281
1282 JNIEXPORT void JNICALL ChannelManagerforcecloseallchannels(JNIEnv * _env, jclass _b, jlong this_arg) {
1283         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1284         return ChannelManager_force_close_all_channels(this_arg_conv);
1285 }
1286
1287 JNIEXPORT jlong JNICALL ChannelManagersendpayment(JNIEnv * _env, jclass _b, jlong this_arg, jlong route, jlong payment_hash, jlong payment_secret) {
1288         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1289         LDKRoute* route_conv = (LDKRoute*)route;
1290         LDKThirtyTwoBytes payment_hash_conv = *(LDKThirtyTwoBytes*)payment_hash;
1291         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
1292         LDKCResult_NonePaymentSendFailureZ* ret = malloc(sizeof(LDKCResult_NonePaymentSendFailureZ));
1293         *ret = ChannelManager_send_payment(this_arg_conv, route_conv, payment_hash_conv, payment_secret_conv);
1294         return (long)ret;
1295 }
1296
1297 JNIEXPORT void JNICALL ChannelManagerfundingtransactiongenerated(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray temporary_channel_id, jlong funding_txo) {
1298         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1299         unsigned char temporary_channel_id_arr[32];
1300         (*_env)->GetByteArrayRegion (_env, temporary_channel_id, 0, 32, temporary_channel_id_arr);
1301         unsigned char (*temporary_channel_id_ref)[32] = &temporary_channel_id_arr;
1302         LDKOutPoint funding_txo_conv = *(LDKOutPoint*)funding_txo;
1303         return ChannelManager_funding_transaction_generated(this_arg_conv, temporary_channel_id_ref, funding_txo_conv);
1304 }
1305
1306 JNIEXPORT void JNICALL ChannelManagerbroadcastnodeannouncement(JNIEnv * _env, jclass _b, jlong this_arg, jlong rgb, jlong alias, jlong addresses) {
1307         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1308         LDKThreeBytes rgb_conv = *(LDKThreeBytes*)rgb;
1309         LDKThirtyTwoBytes alias_conv = *(LDKThirtyTwoBytes*)alias;
1310         LDKCVec_NetAddressZ addresses_conv = *(LDKCVec_NetAddressZ*)addresses;
1311         return ChannelManager_broadcast_node_announcement(this_arg_conv, rgb_conv, alias_conv, addresses_conv);
1312 }
1313
1314 JNIEXPORT void JNICALL ChannelManagerprocesspendinghtlcforwards(JNIEnv * _env, jclass _b, jlong this_arg) {
1315         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1316         return ChannelManager_process_pending_htlc_forwards(this_arg_conv);
1317 }
1318
1319 JNIEXPORT void JNICALL ChannelManagertimerchanfreshnesseverymin(JNIEnv * _env, jclass _b, jlong this_arg) {
1320         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1321         return ChannelManager_timer_chan_freshness_every_min(this_arg_conv);
1322 }
1323
1324 JNIEXPORT jboolean JNICALL ChannelManagerfailhtlcbackwards(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray payment_hash, jlong payment_secret) {
1325         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1326         unsigned char payment_hash_arr[32];
1327         (*_env)->GetByteArrayRegion (_env, payment_hash, 0, 32, payment_hash_arr);
1328         unsigned char (*payment_hash_ref)[32] = &payment_hash_arr;
1329         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
1330         return ChannelManager_fail_htlc_backwards(this_arg_conv, payment_hash_ref, payment_secret_conv);
1331 }
1332
1333 JNIEXPORT jboolean JNICALL ChannelManagerclaimfunds(JNIEnv * _env, jclass _b, jlong this_arg, jlong payment_preimage, jlong payment_secret, jlong expected_amo) {
1334         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1335         LDKThirtyTwoBytes payment_preimage_conv = *(LDKThirtyTwoBytes*)payment_preimage;
1336         LDKThirtyTwoBytes payment_secret_conv = *(LDKThirtyTwoBytes*)payment_secret;
1337         return ChannelManager_claim_funds(this_arg_conv, payment_preimage_conv, payment_secret_conv, expected_amo);
1338 }
1339
1340 JNIEXPORT jlong JNICALL ChannelManagergetournodeid(JNIEnv * _env, jclass _b, jlong this_arg) {
1341         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1342         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1343         *ret = ChannelManager_get_our_node_id(this_arg_conv);
1344         return (long)ret;
1345 }
1346
1347 JNIEXPORT void JNICALL ChannelManagerchannelmonitorupdated(JNIEnv * _env, jclass _b, jlong this_arg, jlong funding_txo, jlong highest_applied_update_id) {
1348         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1349         LDKOutPoint* funding_txo_conv = (LDKOutPoint*)funding_txo;
1350         return ChannelManager_channel_monitor_updated(this_arg_conv, funding_txo_conv, highest_applied_update_id);
1351 }
1352
1353 JNIEXPORT jlong JNICALL ChannelManagerasMessageSendEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
1354         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1355         LDKMessageSendEventsProvider* ret = malloc(sizeof(LDKMessageSendEventsProvider));
1356         *ret = ChannelManager_as_MessageSendEventsProvider(this_arg_conv);
1357         return (long)ret;
1358 }
1359
1360 JNIEXPORT jlong JNICALL ChannelManagerasEventsProvider(JNIEnv * _env, jclass _b, jlong this_arg) {
1361         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1362         LDKEventsProvider* ret = malloc(sizeof(LDKEventsProvider));
1363         *ret = ChannelManager_as_EventsProvider(this_arg_conv);
1364         return (long)ret;
1365 }
1366
1367 JNIEXPORT jlong JNICALL ChannelManagerasChainListener(JNIEnv * _env, jclass _b, jlong this_arg) {
1368         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1369         LDKChainListener* ret = malloc(sizeof(LDKChainListener));
1370         *ret = ChannelManager_as_ChainListener(this_arg_conv);
1371         return (long)ret;
1372 }
1373
1374 JNIEXPORT jlong JNICALL ChannelManagerasChannelMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
1375         LDKChannelManager* this_arg_conv = (LDKChannelManager*)this_arg;
1376         LDKChannelMessageHandler* ret = malloc(sizeof(LDKChannelMessageHandler));
1377         *ret = ChannelManager_as_ChannelMessageHandler(this_arg_conv);
1378         return (long)ret;
1379 }
1380
1381 JNIEXPORT void JNICALL ChannelMonitorUpdatefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1382         LDKChannelMonitorUpdate this_ptr_conv = *(LDKChannelMonitorUpdate*)this_ptr;
1383         return ChannelMonitorUpdate_free(this_ptr_conv);
1384 }
1385
1386 JNIEXPORT jlong JNICALL ChannelMonitorUpdategetupdateid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1387         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
1388         return ChannelMonitorUpdate_get_update_id(this_ptr_conv);
1389 }
1390
1391 JNIEXPORT void JNICALL ChannelMonitorUpdatesetupdateid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1392         LDKChannelMonitorUpdate* this_ptr_conv = (LDKChannelMonitorUpdate*)this_ptr;
1393         return ChannelMonitorUpdate_set_update_id(this_ptr_conv, val);
1394 }
1395
1396 JNIEXPORT jlong JNICALL ChannelMonitorUpdatewrite(JNIEnv * _env, jclass _b, jlong obj) {
1397         LDKChannelMonitorUpdate* obj_conv = (LDKChannelMonitorUpdate*)obj;
1398         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1399         *ret = ChannelMonitorUpdate_write(obj_conv);
1400         return (long)ret;
1401 }
1402
1403 JNIEXPORT jlong JNICALL ChannelMonitorUpdateread(JNIEnv * _env, jclass _b, jlong ser) {
1404         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1405         LDKChannelMonitorUpdate* ret = malloc(sizeof(LDKChannelMonitorUpdate));
1406         *ret = ChannelMonitorUpdate_read(ser_conv);
1407         return (long)ret;
1408 }
1409
1410 JNIEXPORT void JNICALL MonitorUpdateErrorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1411         LDKMonitorUpdateError this_ptr_conv = *(LDKMonitorUpdateError*)this_ptr;
1412         return MonitorUpdateError_free(this_ptr_conv);
1413 }
1414
1415 JNIEXPORT void JNICALL HTLCUpdatefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1416         LDKHTLCUpdate this_ptr_conv = *(LDKHTLCUpdate*)this_ptr;
1417         return HTLCUpdate_free(this_ptr_conv);
1418 }
1419
1420 JNIEXPORT jlong JNICALL HTLCUpdatewrite(JNIEnv * _env, jclass _b, jlong obj) {
1421         LDKHTLCUpdate* obj_conv = (LDKHTLCUpdate*)obj;
1422         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1423         *ret = HTLCUpdate_write(obj_conv);
1424         return (long)ret;
1425 }
1426
1427 JNIEXPORT jlong JNICALL HTLCUpdateread(JNIEnv * _env, jclass _b, jlong ser) {
1428         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1429         LDKHTLCUpdate* ret = malloc(sizeof(LDKHTLCUpdate));
1430         *ret = HTLCUpdate_read(ser_conv);
1431         return (long)ret;
1432 }
1433
1434 JNIEXPORT void JNICALL ChannelMonitorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1435         LDKChannelMonitor this_ptr_conv = *(LDKChannelMonitor*)this_ptr;
1436         return ChannelMonitor_free(this_ptr_conv);
1437 }
1438
1439 JNIEXPORT void JNICALL ManyChannelMonitorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1440         LDKManyChannelMonitor this_ptr_conv = *(LDKManyChannelMonitor*)this_ptr;
1441         return ManyChannelMonitor_free(this_ptr_conv);
1442 }
1443
1444 JNIEXPORT jlong JNICALL ChannelMonitorupdatemonitor(JNIEnv * _env, jclass _b, jlong this_arg, jlong updates, jlong broadcaster, jlong logger) {
1445         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1446         LDKChannelMonitorUpdate updates_conv = *(LDKChannelMonitorUpdate*)updates;
1447         LDKBroadcasterInterface* broadcaster_conv = (LDKBroadcasterInterface*)broadcaster;
1448         LDKLogger* logger_conv = (LDKLogger*)logger;
1449         LDKCResult_NoneMonitorUpdateErrorZ* ret = malloc(sizeof(LDKCResult_NoneMonitorUpdateErrorZ));
1450         *ret = ChannelMonitor_update_monitor(this_arg_conv, updates_conv, broadcaster_conv, logger_conv);
1451         return (long)ret;
1452 }
1453
1454 JNIEXPORT jlong JNICALL ChannelMonitorgetlatestupdateid(JNIEnv * _env, jclass _b, jlong this_arg) {
1455         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1456         return ChannelMonitor_get_latest_update_id(this_arg_conv);
1457 }
1458
1459 JNIEXPORT jlong JNICALL ChannelMonitorgetfundingtxo(JNIEnv * _env, jclass _b, jlong this_arg) {
1460         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1461         LDKC2Tuple_OutPointScriptZ* ret = malloc(sizeof(LDKC2Tuple_OutPointScriptZ));
1462         *ret = ChannelMonitor_get_funding_txo(this_arg_conv);
1463         return (long)ret;
1464 }
1465
1466 JNIEXPORT jlong JNICALL ChannelMonitorgetandclearpendinghtlcsupdated(JNIEnv * _env, jclass _b, jlong this_arg) {
1467         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1468         LDKCVec_HTLCUpdateZ* ret = malloc(sizeof(LDKCVec_HTLCUpdateZ));
1469         *ret = ChannelMonitor_get_and_clear_pending_htlcs_updated(this_arg_conv);
1470         return (long)ret;
1471 }
1472
1473 JNIEXPORT jlong JNICALL ChannelMonitorgetandclearpendingevents(JNIEnv * _env, jclass _b, jlong this_arg) {
1474         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1475         LDKCVec_EventZ* ret = malloc(sizeof(LDKCVec_EventZ));
1476         *ret = ChannelMonitor_get_and_clear_pending_events(this_arg_conv);
1477         return (long)ret;
1478 }
1479
1480 JNIEXPORT jlong JNICALL ChannelMonitorgetlatestlocalcommitmenttxn(JNIEnv * _env, jclass _b, jlong this_arg, jlong logger) {
1481         LDKChannelMonitor* this_arg_conv = (LDKChannelMonitor*)this_arg;
1482         LDKLogger* logger_conv = (LDKLogger*)logger;
1483         LDKCVec_TransactionZ* ret = malloc(sizeof(LDKCVec_TransactionZ));
1484         *ret = ChannelMonitor_get_latest_local_commitment_txn(this_arg_conv, logger_conv);
1485         return (long)ret;
1486 }
1487
1488 JNIEXPORT void JNICALL DecodeErrorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1489         LDKDecodeError this_ptr_conv = *(LDKDecodeError*)this_ptr;
1490         return DecodeError_free(this_ptr_conv);
1491 }
1492
1493 JNIEXPORT void JNICALL Initfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1494         LDKInit this_ptr_conv = *(LDKInit*)this_ptr;
1495         return Init_free(this_ptr_conv);
1496 }
1497
1498 JNIEXPORT void JNICALL ErrorMessagefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1499         LDKErrorMessage this_ptr_conv = *(LDKErrorMessage*)this_ptr;
1500         return ErrorMessage_free(this_ptr_conv);
1501 }
1502
1503 JNIEXPORT void JNICALL Pingfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1504         LDKPing this_ptr_conv = *(LDKPing*)this_ptr;
1505         return Ping_free(this_ptr_conv);
1506 }
1507
1508 JNIEXPORT void JNICALL Pongfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1509         LDKPong this_ptr_conv = *(LDKPong*)this_ptr;
1510         return Pong_free(this_ptr_conv);
1511 }
1512
1513 JNIEXPORT void JNICALL OpenChannelfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1514         LDKOpenChannel this_ptr_conv = *(LDKOpenChannel*)this_ptr;
1515         return OpenChannel_free(this_ptr_conv);
1516 }
1517
1518 JNIEXPORT void JNICALL AcceptChannelfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1519         LDKAcceptChannel this_ptr_conv = *(LDKAcceptChannel*)this_ptr;
1520         return AcceptChannel_free(this_ptr_conv);
1521 }
1522
1523 JNIEXPORT void JNICALL FundingCreatedfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1524         LDKFundingCreated this_ptr_conv = *(LDKFundingCreated*)this_ptr;
1525         return FundingCreated_free(this_ptr_conv);
1526 }
1527
1528 JNIEXPORT void JNICALL FundingSignedfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1529         LDKFundingSigned this_ptr_conv = *(LDKFundingSigned*)this_ptr;
1530         return FundingSigned_free(this_ptr_conv);
1531 }
1532
1533 JNIEXPORT void JNICALL FundingLockedfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1534         LDKFundingLocked this_ptr_conv = *(LDKFundingLocked*)this_ptr;
1535         return FundingLocked_free(this_ptr_conv);
1536 }
1537
1538 JNIEXPORT jbyteArray  JNICALL FundingLockedgetchannelid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1539         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
1540         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
1541         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *FundingLocked_get_channel_id(this_ptr_conv));
1542         return ret_arr;
1543 }
1544
1545 JNIEXPORT void JNICALL FundingLockedsetchannelid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1546         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
1547         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
1548         return FundingLocked_set_channel_id(this_ptr_conv, val_conv);
1549 }
1550
1551 JNIEXPORT jlong JNICALL FundingLockedgetnextpercommitmentpoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
1552         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
1553         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1554         *ret = FundingLocked_get_next_per_commitment_point(this_ptr_conv);
1555         return (long)ret;
1556 }
1557
1558 JNIEXPORT void JNICALL FundingLockedsetnextpercommitmentpoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1559         LDKFundingLocked* this_ptr_conv = (LDKFundingLocked*)this_ptr;
1560         LDKPublicKey val_conv = *(LDKPublicKey*)val;
1561         return FundingLocked_set_next_per_commitment_point(this_ptr_conv, val_conv);
1562 }
1563
1564 JNIEXPORT jlong JNICALL FundingLockednew(JNIEnv * _env, jclass _b, jlong channel_id_arg, jlong next_per_commitment_point_arg) {
1565         LDKThirtyTwoBytes channel_id_arg_conv = *(LDKThirtyTwoBytes*)channel_id_arg;
1566         LDKPublicKey next_per_commitment_point_arg_conv = *(LDKPublicKey*)next_per_commitment_point_arg;
1567         LDKFundingLocked* ret = malloc(sizeof(LDKFundingLocked));
1568         *ret = FundingLocked_new(channel_id_arg_conv, next_per_commitment_point_arg_conv);
1569         return (long)ret;
1570 }
1571
1572 JNIEXPORT void JNICALL Shutdownfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1573         LDKShutdown this_ptr_conv = *(LDKShutdown*)this_ptr;
1574         return Shutdown_free(this_ptr_conv);
1575 }
1576
1577 JNIEXPORT void JNICALL ClosingSignedfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1578         LDKClosingSigned this_ptr_conv = *(LDKClosingSigned*)this_ptr;
1579         return ClosingSigned_free(this_ptr_conv);
1580 }
1581
1582 JNIEXPORT void JNICALL UpdateAddHTLCfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1583         LDKUpdateAddHTLC this_ptr_conv = *(LDKUpdateAddHTLC*)this_ptr;
1584         return UpdateAddHTLC_free(this_ptr_conv);
1585 }
1586
1587 JNIEXPORT void JNICALL UpdateFulfillHTLCfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1588         LDKUpdateFulfillHTLC this_ptr_conv = *(LDKUpdateFulfillHTLC*)this_ptr;
1589         return UpdateFulfillHTLC_free(this_ptr_conv);
1590 }
1591
1592 JNIEXPORT void JNICALL UpdateFailHTLCfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1593         LDKUpdateFailHTLC this_ptr_conv = *(LDKUpdateFailHTLC*)this_ptr;
1594         return UpdateFailHTLC_free(this_ptr_conv);
1595 }
1596
1597 JNIEXPORT void JNICALL UpdateFailMalformedHTLCfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1598         LDKUpdateFailMalformedHTLC this_ptr_conv = *(LDKUpdateFailMalformedHTLC*)this_ptr;
1599         return UpdateFailMalformedHTLC_free(this_ptr_conv);
1600 }
1601
1602 JNIEXPORT void JNICALL CommitmentSignedfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1603         LDKCommitmentSigned this_ptr_conv = *(LDKCommitmentSigned*)this_ptr;
1604         return CommitmentSigned_free(this_ptr_conv);
1605 }
1606
1607 JNIEXPORT void JNICALL RevokeAndACKfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1608         LDKRevokeAndACK this_ptr_conv = *(LDKRevokeAndACK*)this_ptr;
1609         return RevokeAndACK_free(this_ptr_conv);
1610 }
1611
1612 JNIEXPORT void JNICALL UpdateFeefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1613         LDKUpdateFee this_ptr_conv = *(LDKUpdateFee*)this_ptr;
1614         return UpdateFee_free(this_ptr_conv);
1615 }
1616
1617 JNIEXPORT void JNICALL ChannelReestablishfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1618         LDKChannelReestablish this_ptr_conv = *(LDKChannelReestablish*)this_ptr;
1619         return ChannelReestablish_free(this_ptr_conv);
1620 }
1621
1622 JNIEXPORT void JNICALL AnnouncementSignaturesfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1623         LDKAnnouncementSignatures this_ptr_conv = *(LDKAnnouncementSignatures*)this_ptr;
1624         return AnnouncementSignatures_free(this_ptr_conv);
1625 }
1626
1627 JNIEXPORT void JNICALL NetAddressfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1628         LDKNetAddress this_ptr_conv = *(LDKNetAddress*)this_ptr;
1629         return NetAddress_free(this_ptr_conv);
1630 }
1631
1632 JNIEXPORT void JNICALL UnsignedNodeAnnouncementfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1633         LDKUnsignedNodeAnnouncement this_ptr_conv = *(LDKUnsignedNodeAnnouncement*)this_ptr;
1634         return UnsignedNodeAnnouncement_free(this_ptr_conv);
1635 }
1636
1637 JNIEXPORT jlong JNICALL UnsignedNodeAnnouncementgetnodeid(JNIEnv * _env, jclass _b, jlong this_ptr) {
1638         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
1639         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1640         *ret = UnsignedNodeAnnouncement_get_node_id(this_ptr_conv);
1641         return (long)ret;
1642 }
1643
1644 JNIEXPORT void JNICALL UnsignedNodeAnnouncementsetnodeid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1645         LDKUnsignedNodeAnnouncement* this_ptr_conv = (LDKUnsignedNodeAnnouncement*)this_ptr;
1646         LDKPublicKey val_conv = *(LDKPublicKey*)val;
1647         return UnsignedNodeAnnouncement_set_node_id(this_ptr_conv, val_conv);
1648 }
1649
1650 JNIEXPORT void JNICALL NodeAnnouncementfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1651         LDKNodeAnnouncement this_ptr_conv = *(LDKNodeAnnouncement*)this_ptr;
1652         return NodeAnnouncement_free(this_ptr_conv);
1653 }
1654
1655 JNIEXPORT void JNICALL UnsignedChannelAnnouncementfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1656         LDKUnsignedChannelAnnouncement this_ptr_conv = *(LDKUnsignedChannelAnnouncement*)this_ptr;
1657         return UnsignedChannelAnnouncement_free(this_ptr_conv);
1658 }
1659
1660 JNIEXPORT jlong JNICALL UnsignedChannelAnnouncementgetnodeid1(JNIEnv * _env, jclass _b, jlong this_ptr) {
1661         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
1662         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1663         *ret = UnsignedChannelAnnouncement_get_node_id_1(this_ptr_conv);
1664         return (long)ret;
1665 }
1666
1667 JNIEXPORT void JNICALL UnsignedChannelAnnouncementsetnodeid1(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1668         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
1669         LDKPublicKey val_conv = *(LDKPublicKey*)val;
1670         return UnsignedChannelAnnouncement_set_node_id_1(this_ptr_conv, val_conv);
1671 }
1672
1673 JNIEXPORT jlong JNICALL UnsignedChannelAnnouncementgetnodeid2(JNIEnv * _env, jclass _b, jlong this_ptr) {
1674         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
1675         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
1676         *ret = UnsignedChannelAnnouncement_get_node_id_2(this_ptr_conv);
1677         return (long)ret;
1678 }
1679
1680 JNIEXPORT void JNICALL UnsignedChannelAnnouncementsetnodeid2(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1681         LDKUnsignedChannelAnnouncement* this_ptr_conv = (LDKUnsignedChannelAnnouncement*)this_ptr;
1682         LDKPublicKey val_conv = *(LDKPublicKey*)val;
1683         return UnsignedChannelAnnouncement_set_node_id_2(this_ptr_conv, val_conv);
1684 }
1685
1686 JNIEXPORT void JNICALL ChannelAnnouncementfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1687         LDKChannelAnnouncement this_ptr_conv = *(LDKChannelAnnouncement*)this_ptr;
1688         return ChannelAnnouncement_free(this_ptr_conv);
1689 }
1690
1691 JNIEXPORT void JNICALL ChannelUpdatefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1692         LDKChannelUpdate this_ptr_conv = *(LDKChannelUpdate*)this_ptr;
1693         return ChannelUpdate_free(this_ptr_conv);
1694 }
1695
1696 JNIEXPORT void JNICALL ErrorActionfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1697         LDKErrorAction this_ptr_conv = *(LDKErrorAction*)this_ptr;
1698         return ErrorAction_free(this_ptr_conv);
1699 }
1700
1701 JNIEXPORT void JNICALL LightningErrorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1702         LDKLightningError this_ptr_conv = *(LDKLightningError*)this_ptr;
1703         return LightningError_free(this_ptr_conv);
1704 }
1705
1706 JNIEXPORT jlong JNICALL LightningErrorgeterr(JNIEnv * _env, jclass _b, jlong this_ptr) {
1707         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
1708         LDKStr* ret = malloc(sizeof(LDKStr));
1709         *ret = LightningError_get_err(this_ptr_conv);
1710         return (long)ret;
1711 }
1712
1713 JNIEXPORT void JNICALL LightningErrorseterr(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1714         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
1715         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
1716         return LightningError_set_err(this_ptr_conv, val_conv);
1717 }
1718
1719 JNIEXPORT jlong JNICALL LightningErrorgetaction(JNIEnv * _env, jclass _b, jlong this_ptr) {
1720         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
1721         LDKErrorAction* ret = malloc(sizeof(LDKErrorAction));
1722         *ret = LightningError_get_action(this_ptr_conv);
1723         return (long)ret;
1724 }
1725
1726 JNIEXPORT void JNICALL LightningErrorsetaction(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1727         LDKLightningError* this_ptr_conv = (LDKLightningError*)this_ptr;
1728         LDKErrorAction val_conv = *(LDKErrorAction*)val;
1729         return LightningError_set_action(this_ptr_conv, val_conv);
1730 }
1731
1732 JNIEXPORT jlong JNICALL LightningErrornew(JNIEnv * _env, jclass _b, jlong err_arg, jlong action_arg) {
1733         LDKCVec_u8Z err_arg_conv = *(LDKCVec_u8Z*)err_arg;
1734         LDKErrorAction action_arg_conv = *(LDKErrorAction*)action_arg;
1735         LDKLightningError* ret = malloc(sizeof(LDKLightningError));
1736         *ret = LightningError_new(err_arg_conv, action_arg_conv);
1737         return (long)ret;
1738 }
1739
1740 JNIEXPORT void JNICALL CommitmentUpdatefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1741         LDKCommitmentUpdate this_ptr_conv = *(LDKCommitmentUpdate*)this_ptr;
1742         return CommitmentUpdate_free(this_ptr_conv);
1743 }
1744
1745 JNIEXPORT void JNICALL CommitmentUpdatesetupdateaddhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1746         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1747         LDKCVec_UpdateAddHTLCZ val_conv = *(LDKCVec_UpdateAddHTLCZ*)val;
1748         return CommitmentUpdate_set_update_add_htlcs(this_ptr_conv, val_conv);
1749 }
1750
1751 JNIEXPORT void JNICALL CommitmentUpdatesetupdatefulfillhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1752         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1753         LDKCVec_UpdateFulfillHTLCZ val_conv = *(LDKCVec_UpdateFulfillHTLCZ*)val;
1754         return CommitmentUpdate_set_update_fulfill_htlcs(this_ptr_conv, val_conv);
1755 }
1756
1757 JNIEXPORT void JNICALL CommitmentUpdatesetupdatefailhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1758         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1759         LDKCVec_UpdateFailHTLCZ val_conv = *(LDKCVec_UpdateFailHTLCZ*)val;
1760         return CommitmentUpdate_set_update_fail_htlcs(this_ptr_conv, val_conv);
1761 }
1762
1763 JNIEXPORT void JNICALL CommitmentUpdatesetupdatefailmalformedhtlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1764         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1765         LDKCVec_UpdateFailMalformedHTLCZ val_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)val;
1766         return CommitmentUpdate_set_update_fail_malformed_htlcs(this_ptr_conv, val_conv);
1767 }
1768
1769 JNIEXPORT jlong JNICALL CommitmentUpdategetupdatefee(JNIEnv * _env, jclass _b, jlong this_ptr) {
1770         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1771         LDKUpdateFee* ret = malloc(sizeof(LDKUpdateFee));
1772         *ret = CommitmentUpdate_get_update_fee(this_ptr_conv);
1773         return (long)ret;
1774 }
1775
1776 JNIEXPORT void JNICALL CommitmentUpdatesetupdatefee(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1777         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1778         LDKUpdateFee val_conv = *(LDKUpdateFee*)val;
1779         return CommitmentUpdate_set_update_fee(this_ptr_conv, val_conv);
1780 }
1781
1782 JNIEXPORT jlong JNICALL CommitmentUpdategetcommitmentsigned(JNIEnv * _env, jclass _b, jlong this_ptr) {
1783         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1784         LDKCommitmentSigned* ret = malloc(sizeof(LDKCommitmentSigned));
1785         *ret = CommitmentUpdate_get_commitment_signed(this_ptr_conv);
1786         return (long)ret;
1787 }
1788
1789 JNIEXPORT void JNICALL CommitmentUpdatesetcommitmentsigned(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
1790         LDKCommitmentUpdate* this_ptr_conv = (LDKCommitmentUpdate*)this_ptr;
1791         LDKCommitmentSigned val_conv = *(LDKCommitmentSigned*)val;
1792         return CommitmentUpdate_set_commitment_signed(this_ptr_conv, val_conv);
1793 }
1794
1795 JNIEXPORT jlong JNICALL CommitmentUpdatenew(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) {
1796         LDKCVec_UpdateAddHTLCZ update_add_htlcs_arg_conv = *(LDKCVec_UpdateAddHTLCZ*)update_add_htlcs_arg;
1797         LDKCVec_UpdateFulfillHTLCZ update_fulfill_htlcs_arg_conv = *(LDKCVec_UpdateFulfillHTLCZ*)update_fulfill_htlcs_arg;
1798         LDKCVec_UpdateFailHTLCZ update_fail_htlcs_arg_conv = *(LDKCVec_UpdateFailHTLCZ*)update_fail_htlcs_arg;
1799         LDKCVec_UpdateFailMalformedHTLCZ update_fail_malformed_htlcs_arg_conv = *(LDKCVec_UpdateFailMalformedHTLCZ*)update_fail_malformed_htlcs_arg;
1800         LDKUpdateFee update_fee_arg_conv = *(LDKUpdateFee*)update_fee_arg;
1801         LDKCommitmentSigned commitment_signed_arg_conv = *(LDKCommitmentSigned*)commitment_signed_arg;
1802         LDKCommitmentUpdate* ret = malloc(sizeof(LDKCommitmentUpdate));
1803         *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);
1804         return (long)ret;
1805 }
1806
1807 JNIEXPORT void JNICALL HTLCFailChannelUpdatefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1808         LDKHTLCFailChannelUpdate this_ptr_conv = *(LDKHTLCFailChannelUpdate*)this_ptr;
1809         return HTLCFailChannelUpdate_free(this_ptr_conv);
1810 }
1811
1812 JNIEXPORT void JNICALL ChannelMessageHandlerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1813         LDKChannelMessageHandler this_ptr_conv = *(LDKChannelMessageHandler*)this_ptr;
1814         return ChannelMessageHandler_free(this_ptr_conv);
1815 }
1816
1817 JNIEXPORT void JNICALL RoutingMessageHandlerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
1818         LDKRoutingMessageHandler this_ptr_conv = *(LDKRoutingMessageHandler*)this_ptr;
1819         return RoutingMessageHandler_free(this_ptr_conv);
1820 }
1821
1822 JNIEXPORT jlong JNICALL AcceptChannelwrite(JNIEnv * _env, jclass _b, jlong obj) {
1823         LDKAcceptChannel* obj_conv = (LDKAcceptChannel*)obj;
1824         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1825         *ret = AcceptChannel_write(obj_conv);
1826         return (long)ret;
1827 }
1828
1829 JNIEXPORT jlong JNICALL AcceptChannelread(JNIEnv * _env, jclass _b, jlong ser) {
1830         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1831         LDKAcceptChannel* ret = malloc(sizeof(LDKAcceptChannel));
1832         *ret = AcceptChannel_read(ser_conv);
1833         return (long)ret;
1834 }
1835
1836 JNIEXPORT jlong JNICALL AnnouncementSignatureswrite(JNIEnv * _env, jclass _b, jlong obj) {
1837         LDKAnnouncementSignatures* obj_conv = (LDKAnnouncementSignatures*)obj;
1838         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1839         *ret = AnnouncementSignatures_write(obj_conv);
1840         return (long)ret;
1841 }
1842
1843 JNIEXPORT jlong JNICALL AnnouncementSignaturesread(JNIEnv * _env, jclass _b, jlong ser) {
1844         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1845         LDKAnnouncementSignatures* ret = malloc(sizeof(LDKAnnouncementSignatures));
1846         *ret = AnnouncementSignatures_read(ser_conv);
1847         return (long)ret;
1848 }
1849
1850 JNIEXPORT jlong JNICALL ChannelReestablishwrite(JNIEnv * _env, jclass _b, jlong obj) {
1851         LDKChannelReestablish* obj_conv = (LDKChannelReestablish*)obj;
1852         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1853         *ret = ChannelReestablish_write(obj_conv);
1854         return (long)ret;
1855 }
1856
1857 JNIEXPORT jlong JNICALL ChannelReestablishread(JNIEnv * _env, jclass _b, jlong ser) {
1858         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1859         LDKChannelReestablish* ret = malloc(sizeof(LDKChannelReestablish));
1860         *ret = ChannelReestablish_read(ser_conv);
1861         return (long)ret;
1862 }
1863
1864 JNIEXPORT jlong JNICALL ClosingSignedwrite(JNIEnv * _env, jclass _b, jlong obj) {
1865         LDKClosingSigned* obj_conv = (LDKClosingSigned*)obj;
1866         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1867         *ret = ClosingSigned_write(obj_conv);
1868         return (long)ret;
1869 }
1870
1871 JNIEXPORT jlong JNICALL ClosingSignedread(JNIEnv * _env, jclass _b, jlong ser) {
1872         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1873         LDKClosingSigned* ret = malloc(sizeof(LDKClosingSigned));
1874         *ret = ClosingSigned_read(ser_conv);
1875         return (long)ret;
1876 }
1877
1878 JNIEXPORT jlong JNICALL CommitmentSignedwrite(JNIEnv * _env, jclass _b, jlong obj) {
1879         LDKCommitmentSigned* obj_conv = (LDKCommitmentSigned*)obj;
1880         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1881         *ret = CommitmentSigned_write(obj_conv);
1882         return (long)ret;
1883 }
1884
1885 JNIEXPORT jlong JNICALL CommitmentSignedread(JNIEnv * _env, jclass _b, jlong ser) {
1886         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1887         LDKCommitmentSigned* ret = malloc(sizeof(LDKCommitmentSigned));
1888         *ret = CommitmentSigned_read(ser_conv);
1889         return (long)ret;
1890 }
1891
1892 JNIEXPORT jlong JNICALL FundingCreatedwrite(JNIEnv * _env, jclass _b, jlong obj) {
1893         LDKFundingCreated* obj_conv = (LDKFundingCreated*)obj;
1894         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1895         *ret = FundingCreated_write(obj_conv);
1896         return (long)ret;
1897 }
1898
1899 JNIEXPORT jlong JNICALL FundingCreatedread(JNIEnv * _env, jclass _b, jlong ser) {
1900         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1901         LDKFundingCreated* ret = malloc(sizeof(LDKFundingCreated));
1902         *ret = FundingCreated_read(ser_conv);
1903         return (long)ret;
1904 }
1905
1906 JNIEXPORT jlong JNICALL FundingSignedwrite(JNIEnv * _env, jclass _b, jlong obj) {
1907         LDKFundingSigned* obj_conv = (LDKFundingSigned*)obj;
1908         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1909         *ret = FundingSigned_write(obj_conv);
1910         return (long)ret;
1911 }
1912
1913 JNIEXPORT jlong JNICALL FundingSignedread(JNIEnv * _env, jclass _b, jlong ser) {
1914         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1915         LDKFundingSigned* ret = malloc(sizeof(LDKFundingSigned));
1916         *ret = FundingSigned_read(ser_conv);
1917         return (long)ret;
1918 }
1919
1920 JNIEXPORT jlong JNICALL FundingLockedwrite(JNIEnv * _env, jclass _b, jlong obj) {
1921         LDKFundingLocked* obj_conv = (LDKFundingLocked*)obj;
1922         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1923         *ret = FundingLocked_write(obj_conv);
1924         return (long)ret;
1925 }
1926
1927 JNIEXPORT jlong JNICALL FundingLockedread(JNIEnv * _env, jclass _b, jlong ser) {
1928         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1929         LDKFundingLocked* ret = malloc(sizeof(LDKFundingLocked));
1930         *ret = FundingLocked_read(ser_conv);
1931         return (long)ret;
1932 }
1933
1934 JNIEXPORT jlong JNICALL Initwrite(JNIEnv * _env, jclass _b, jlong obj) {
1935         LDKInit* obj_conv = (LDKInit*)obj;
1936         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1937         *ret = Init_write(obj_conv);
1938         return (long)ret;
1939 }
1940
1941 JNIEXPORT jlong JNICALL Initread(JNIEnv * _env, jclass _b, jlong ser) {
1942         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1943         LDKInit* ret = malloc(sizeof(LDKInit));
1944         *ret = Init_read(ser_conv);
1945         return (long)ret;
1946 }
1947
1948 JNIEXPORT jlong JNICALL OpenChannelwrite(JNIEnv * _env, jclass _b, jlong obj) {
1949         LDKOpenChannel* obj_conv = (LDKOpenChannel*)obj;
1950         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1951         *ret = OpenChannel_write(obj_conv);
1952         return (long)ret;
1953 }
1954
1955 JNIEXPORT jlong JNICALL OpenChannelread(JNIEnv * _env, jclass _b, jlong ser) {
1956         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1957         LDKOpenChannel* ret = malloc(sizeof(LDKOpenChannel));
1958         *ret = OpenChannel_read(ser_conv);
1959         return (long)ret;
1960 }
1961
1962 JNIEXPORT jlong JNICALL RevokeAndACKwrite(JNIEnv * _env, jclass _b, jlong obj) {
1963         LDKRevokeAndACK* obj_conv = (LDKRevokeAndACK*)obj;
1964         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1965         *ret = RevokeAndACK_write(obj_conv);
1966         return (long)ret;
1967 }
1968
1969 JNIEXPORT jlong JNICALL RevokeAndACKread(JNIEnv * _env, jclass _b, jlong ser) {
1970         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1971         LDKRevokeAndACK* ret = malloc(sizeof(LDKRevokeAndACK));
1972         *ret = RevokeAndACK_read(ser_conv);
1973         return (long)ret;
1974 }
1975
1976 JNIEXPORT jlong JNICALL Shutdownwrite(JNIEnv * _env, jclass _b, jlong obj) {
1977         LDKShutdown* obj_conv = (LDKShutdown*)obj;
1978         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1979         *ret = Shutdown_write(obj_conv);
1980         return (long)ret;
1981 }
1982
1983 JNIEXPORT jlong JNICALL Shutdownread(JNIEnv * _env, jclass _b, jlong ser) {
1984         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1985         LDKShutdown* ret = malloc(sizeof(LDKShutdown));
1986         *ret = Shutdown_read(ser_conv);
1987         return (long)ret;
1988 }
1989
1990 JNIEXPORT jlong JNICALL UpdateFailHTLCwrite(JNIEnv * _env, jclass _b, jlong obj) {
1991         LDKUpdateFailHTLC* obj_conv = (LDKUpdateFailHTLC*)obj;
1992         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
1993         *ret = UpdateFailHTLC_write(obj_conv);
1994         return (long)ret;
1995 }
1996
1997 JNIEXPORT jlong JNICALL UpdateFailHTLCread(JNIEnv * _env, jclass _b, jlong ser) {
1998         LDKu8slice ser_conv = *(LDKu8slice*)ser;
1999         LDKUpdateFailHTLC* ret = malloc(sizeof(LDKUpdateFailHTLC));
2000         *ret = UpdateFailHTLC_read(ser_conv);
2001         return (long)ret;
2002 }
2003
2004 JNIEXPORT jlong JNICALL UpdateFailMalformedHTLCwrite(JNIEnv * _env, jclass _b, jlong obj) {
2005         LDKUpdateFailMalformedHTLC* obj_conv = (LDKUpdateFailMalformedHTLC*)obj;
2006         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2007         *ret = UpdateFailMalformedHTLC_write(obj_conv);
2008         return (long)ret;
2009 }
2010
2011 JNIEXPORT jlong JNICALL UpdateFailMalformedHTLCread(JNIEnv * _env, jclass _b, jlong ser) {
2012         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2013         LDKUpdateFailMalformedHTLC* ret = malloc(sizeof(LDKUpdateFailMalformedHTLC));
2014         *ret = UpdateFailMalformedHTLC_read(ser_conv);
2015         return (long)ret;
2016 }
2017
2018 JNIEXPORT jlong JNICALL UpdateFeewrite(JNIEnv * _env, jclass _b, jlong obj) {
2019         LDKUpdateFee* obj_conv = (LDKUpdateFee*)obj;
2020         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2021         *ret = UpdateFee_write(obj_conv);
2022         return (long)ret;
2023 }
2024
2025 JNIEXPORT jlong JNICALL UpdateFeeread(JNIEnv * _env, jclass _b, jlong ser) {
2026         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2027         LDKUpdateFee* ret = malloc(sizeof(LDKUpdateFee));
2028         *ret = UpdateFee_read(ser_conv);
2029         return (long)ret;
2030 }
2031
2032 JNIEXPORT jlong JNICALL UpdateFulfillHTLCwrite(JNIEnv * _env, jclass _b, jlong obj) {
2033         LDKUpdateFulfillHTLC* obj_conv = (LDKUpdateFulfillHTLC*)obj;
2034         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2035         *ret = UpdateFulfillHTLC_write(obj_conv);
2036         return (long)ret;
2037 }
2038
2039 JNIEXPORT jlong JNICALL UpdateFulfillHTLCread(JNIEnv * _env, jclass _b, jlong ser) {
2040         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2041         LDKUpdateFulfillHTLC* ret = malloc(sizeof(LDKUpdateFulfillHTLC));
2042         *ret = UpdateFulfillHTLC_read(ser_conv);
2043         return (long)ret;
2044 }
2045
2046 JNIEXPORT jlong JNICALL UpdateAddHTLCwrite(JNIEnv * _env, jclass _b, jlong obj) {
2047         LDKUpdateAddHTLC* obj_conv = (LDKUpdateAddHTLC*)obj;
2048         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2049         *ret = UpdateAddHTLC_write(obj_conv);
2050         return (long)ret;
2051 }
2052
2053 JNIEXPORT jlong JNICALL UpdateAddHTLCread(JNIEnv * _env, jclass _b, jlong ser) {
2054         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2055         LDKUpdateAddHTLC* ret = malloc(sizeof(LDKUpdateAddHTLC));
2056         *ret = UpdateAddHTLC_read(ser_conv);
2057         return (long)ret;
2058 }
2059
2060 JNIEXPORT jlong JNICALL Pingwrite(JNIEnv * _env, jclass _b, jlong obj) {
2061         LDKPing* obj_conv = (LDKPing*)obj;
2062         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2063         *ret = Ping_write(obj_conv);
2064         return (long)ret;
2065 }
2066
2067 JNIEXPORT jlong JNICALL Pingread(JNIEnv * _env, jclass _b, jlong ser) {
2068         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2069         LDKPing* ret = malloc(sizeof(LDKPing));
2070         *ret = Ping_read(ser_conv);
2071         return (long)ret;
2072 }
2073
2074 JNIEXPORT jlong JNICALL Pongwrite(JNIEnv * _env, jclass _b, jlong obj) {
2075         LDKPong* obj_conv = (LDKPong*)obj;
2076         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2077         *ret = Pong_write(obj_conv);
2078         return (long)ret;
2079 }
2080
2081 JNIEXPORT jlong JNICALL Pongread(JNIEnv * _env, jclass _b, jlong ser) {
2082         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2083         LDKPong* ret = malloc(sizeof(LDKPong));
2084         *ret = Pong_read(ser_conv);
2085         return (long)ret;
2086 }
2087
2088 JNIEXPORT jlong JNICALL UnsignedChannelAnnouncementwrite(JNIEnv * _env, jclass _b, jlong obj) {
2089         LDKUnsignedChannelAnnouncement* obj_conv = (LDKUnsignedChannelAnnouncement*)obj;
2090         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2091         *ret = UnsignedChannelAnnouncement_write(obj_conv);
2092         return (long)ret;
2093 }
2094
2095 JNIEXPORT jlong JNICALL UnsignedChannelAnnouncementread(JNIEnv * _env, jclass _b, jlong ser) {
2096         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2097         LDKUnsignedChannelAnnouncement* ret = malloc(sizeof(LDKUnsignedChannelAnnouncement));
2098         *ret = UnsignedChannelAnnouncement_read(ser_conv);
2099         return (long)ret;
2100 }
2101
2102 JNIEXPORT jlong JNICALL ChannelAnnouncementwrite(JNIEnv * _env, jclass _b, jlong obj) {
2103         LDKChannelAnnouncement* obj_conv = (LDKChannelAnnouncement*)obj;
2104         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2105         *ret = ChannelAnnouncement_write(obj_conv);
2106         return (long)ret;
2107 }
2108
2109 JNIEXPORT jlong JNICALL ChannelAnnouncementread(JNIEnv * _env, jclass _b, jlong ser) {
2110         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2111         LDKChannelAnnouncement* ret = malloc(sizeof(LDKChannelAnnouncement));
2112         *ret = ChannelAnnouncement_read(ser_conv);
2113         return (long)ret;
2114 }
2115
2116 JNIEXPORT jlong JNICALL ChannelUpdatewrite(JNIEnv * _env, jclass _b, jlong obj) {
2117         LDKChannelUpdate* obj_conv = (LDKChannelUpdate*)obj;
2118         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2119         *ret = ChannelUpdate_write(obj_conv);
2120         return (long)ret;
2121 }
2122
2123 JNIEXPORT jlong JNICALL ChannelUpdateread(JNIEnv * _env, jclass _b, jlong ser) {
2124         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2125         LDKChannelUpdate* ret = malloc(sizeof(LDKChannelUpdate));
2126         *ret = ChannelUpdate_read(ser_conv);
2127         return (long)ret;
2128 }
2129
2130 JNIEXPORT jlong JNICALL ErrorMessagewrite(JNIEnv * _env, jclass _b, jlong obj) {
2131         LDKErrorMessage* obj_conv = (LDKErrorMessage*)obj;
2132         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2133         *ret = ErrorMessage_write(obj_conv);
2134         return (long)ret;
2135 }
2136
2137 JNIEXPORT jlong JNICALL ErrorMessageread(JNIEnv * _env, jclass _b, jlong ser) {
2138         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2139         LDKErrorMessage* ret = malloc(sizeof(LDKErrorMessage));
2140         *ret = ErrorMessage_read(ser_conv);
2141         return (long)ret;
2142 }
2143
2144 JNIEXPORT jlong JNICALL UnsignedNodeAnnouncementwrite(JNIEnv * _env, jclass _b, jlong obj) {
2145         LDKUnsignedNodeAnnouncement* obj_conv = (LDKUnsignedNodeAnnouncement*)obj;
2146         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2147         *ret = UnsignedNodeAnnouncement_write(obj_conv);
2148         return (long)ret;
2149 }
2150
2151 JNIEXPORT jlong JNICALL UnsignedNodeAnnouncementread(JNIEnv * _env, jclass _b, jlong ser) {
2152         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2153         LDKUnsignedNodeAnnouncement* ret = malloc(sizeof(LDKUnsignedNodeAnnouncement));
2154         *ret = UnsignedNodeAnnouncement_read(ser_conv);
2155         return (long)ret;
2156 }
2157
2158 JNIEXPORT jlong JNICALL NodeAnnouncementwrite(JNIEnv * _env, jclass _b, jlong obj) {
2159         LDKNodeAnnouncement* obj_conv = (LDKNodeAnnouncement*)obj;
2160         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2161         *ret = NodeAnnouncement_write(obj_conv);
2162         return (long)ret;
2163 }
2164
2165 JNIEXPORT jlong JNICALL NodeAnnouncementread(JNIEnv * _env, jclass _b, jlong ser) {
2166         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2167         LDKNodeAnnouncement* ret = malloc(sizeof(LDKNodeAnnouncement));
2168         *ret = NodeAnnouncement_read(ser_conv);
2169         return (long)ret;
2170 }
2171
2172 JNIEXPORT void JNICALL MessageHandlerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2173         LDKMessageHandler this_ptr_conv = *(LDKMessageHandler*)this_ptr;
2174         return MessageHandler_free(this_ptr_conv);
2175 }
2176
2177 JNIEXPORT jlong JNICALL MessageHandlergetchanhandler(JNIEnv * _env, jclass _b, jlong this_ptr) {
2178         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
2179         return (long) MessageHandler_get_chan_handler(this_ptr_conv);
2180 }
2181
2182 JNIEXPORT void JNICALL MessageHandlersetchanhandler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2183         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
2184         LDKChannelMessageHandler val_conv = *(LDKChannelMessageHandler*)val;
2185         return MessageHandler_set_chan_handler(this_ptr_conv, val_conv);
2186 }
2187
2188 JNIEXPORT jlong JNICALL MessageHandlergetroutehandler(JNIEnv * _env, jclass _b, jlong this_ptr) {
2189         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
2190         return (long) MessageHandler_get_route_handler(this_ptr_conv);
2191 }
2192
2193 JNIEXPORT void JNICALL MessageHandlersetroutehandler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2194         LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
2195         LDKRoutingMessageHandler val_conv = *(LDKRoutingMessageHandler*)val;
2196         return MessageHandler_set_route_handler(this_ptr_conv, val_conv);
2197 }
2198
2199 JNIEXPORT jlong JNICALL MessageHandlernew(JNIEnv * _env, jclass _b, jlong chan_handler_arg, jlong route_handler_arg) {
2200         LDKChannelMessageHandler chan_handler_arg_conv = *(LDKChannelMessageHandler*)chan_handler_arg;
2201         LDKRoutingMessageHandler route_handler_arg_conv = *(LDKRoutingMessageHandler*)route_handler_arg;
2202         LDKMessageHandler* ret = malloc(sizeof(LDKMessageHandler));
2203         *ret = MessageHandler_new(chan_handler_arg_conv, route_handler_arg_conv);
2204         return (long)ret;
2205 }
2206
2207 JNIEXPORT void JNICALL SocketDescriptorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2208         LDKSocketDescriptor this_ptr_conv = *(LDKSocketDescriptor*)this_ptr;
2209         return SocketDescriptor_free(this_ptr_conv);
2210 }
2211
2212 JNIEXPORT void JNICALL PeerHandleErrorfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2213         LDKPeerHandleError this_ptr_conv = *(LDKPeerHandleError*)this_ptr;
2214         return PeerHandleError_free(this_ptr_conv);
2215 }
2216
2217 JNIEXPORT jboolean JNICALL PeerHandleErrorgetnoconnectionpossible(JNIEnv * _env, jclass _b, jlong this_ptr) {
2218         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
2219         return PeerHandleError_get_no_connection_possible(this_ptr_conv);
2220 }
2221
2222 JNIEXPORT void JNICALL PeerHandleErrorsetnoconnectionpossible(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
2223         LDKPeerHandleError* this_ptr_conv = (LDKPeerHandleError*)this_ptr;
2224         return PeerHandleError_set_no_connection_possible(this_ptr_conv, va);
2225 }
2226
2227 JNIEXPORT jlong JNICALL PeerHandleErrornew(JNIEnv * _env, jclass _b, jboolean no_connection_possible_arg) {
2228         LDKPeerHandleError* ret = malloc(sizeof(LDKPeerHandleError));
2229         *ret = PeerHandleError_new(no_connection_possible_arg);
2230         return (long)ret;
2231 }
2232
2233 JNIEXPORT void JNICALL PeerManagerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2234         LDKPeerManager this_ptr_conv = *(LDKPeerManager*)this_ptr;
2235         return PeerManager_free(this_ptr_conv);
2236 }
2237
2238 JNIEXPORT jlong JNICALL PeerManagernew(JNIEnv * _env, jclass _b, jlong message_handler, jlong our_node_secret, jbyteArray ephemeral_random_data, jlong logger) {
2239         LDKMessageHandler message_handler_conv = *(LDKMessageHandler*)message_handler;
2240         LDKSecretKey our_node_secret_conv = *(LDKSecretKey*)our_node_secret;
2241         unsigned char ephemeral_random_data_arr[32];
2242         (*_env)->GetByteArrayRegion (_env, ephemeral_random_data, 0, 32, ephemeral_random_data_arr);
2243         unsigned char (*ephemeral_random_data_ref)[32] = &ephemeral_random_data_arr;
2244         LDKLogger logger_conv = *(LDKLogger*)logger;
2245         LDKPeerManager* ret = malloc(sizeof(LDKPeerManager));
2246         *ret = PeerManager_new(message_handler_conv, our_node_secret_conv, ephemeral_random_data_ref, logger_conv);
2247         return (long)ret;
2248 }
2249
2250 JNIEXPORT jlong JNICALL PeerManagergetpeernodeids(JNIEnv * _env, jclass _b, jlong this_arg) {
2251         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2252         LDKCVec_PublicKeyZ* ret = malloc(sizeof(LDKCVec_PublicKeyZ));
2253         *ret = PeerManager_get_peer_node_ids(this_arg_conv);
2254         return (long)ret;
2255 }
2256
2257 JNIEXPORT jlong JNICALL PeerManagernewoutboundconnection(JNIEnv * _env, jclass _b, jlong this_arg, jlong their_node_id, jlong descriptor) {
2258         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2259         LDKPublicKey their_node_id_conv = *(LDKPublicKey*)their_node_id;
2260         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
2261         LDKCResult_CVec_u8ZPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_CVec_u8ZPeerHandleErrorZ));
2262         *ret = PeerManager_new_outbound_connection(this_arg_conv, their_node_id_conv, descriptor_conv);
2263         return (long)ret;
2264 }
2265
2266 JNIEXPORT jlong JNICALL PeerManagernewinboundconnection(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
2267         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2268         LDKSocketDescriptor descriptor_conv = *(LDKSocketDescriptor*)descriptor;
2269         LDKCResult_NonePeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_NonePeerHandleErrorZ));
2270         *ret = PeerManager_new_inbound_connection(this_arg_conv, descriptor_conv);
2271         return (long)ret;
2272 }
2273
2274 JNIEXPORT jlong JNICALL PeerManagerwritebufferspaceavail(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
2275         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2276         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
2277         LDKCResult_NonePeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_NonePeerHandleErrorZ));
2278         *ret = PeerManager_write_buffer_space_avail(this_arg_conv, descriptor_conv);
2279         return (long)ret;
2280 }
2281
2282 JNIEXPORT jlong JNICALL PeerManagerreadevent(JNIEnv * _env, jclass _b, jlong this_arg, jlong peer_descriptor, jlong data) {
2283         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2284         LDKSocketDescriptor* peer_descriptor_conv = (LDKSocketDescriptor*)peer_descriptor;
2285         LDKu8slice data_conv = *(LDKu8slice*)data;
2286         LDKCResult_boolPeerHandleErrorZ* ret = malloc(sizeof(LDKCResult_boolPeerHandleErrorZ));
2287         *ret = PeerManager_read_event(this_arg_conv, peer_descriptor_conv, data_conv);
2288         return (long)ret;
2289 }
2290
2291 JNIEXPORT void JNICALL PeerManagerprocessevents(JNIEnv * _env, jclass _b, jlong this_arg) {
2292         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2293         return PeerManager_process_events(this_arg_conv);
2294 }
2295
2296 JNIEXPORT void JNICALL PeerManagersocketdisconnected(JNIEnv * _env, jclass _b, jlong this_arg, jlong descriptor) {
2297         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2298         LDKSocketDescriptor* descriptor_conv = (LDKSocketDescriptor*)descriptor;
2299         return PeerManager_socket_disconnected(this_arg_conv, descriptor_conv);
2300 }
2301
2302 JNIEXPORT void JNICALL PeerManagertimertickoccured(JNIEnv * _env, jclass _b, jlong this_arg) {
2303         LDKPeerManager* this_arg_conv = (LDKPeerManager*)this_arg;
2304         return PeerManager_timer_tick_occured(this_arg_conv);
2305 }
2306
2307 JNIEXPORT jlong JNICALL buildcommitmentsecret(JNIEnv * _env, jclass _b, jbyteArray commitment_seed, jlong dx) {
2308         unsigned char commitment_seed_arr[32];
2309         (*_env)->GetByteArrayRegion (_env, commitment_seed, 0, 32, commitment_seed_arr);
2310         unsigned char (*commitment_seed_ref)[32] = &commitment_seed_arr;
2311         LDKThirtyTwoBytes* ret = malloc(sizeof(LDKThirtyTwoBytes));
2312         *ret = build_commitment_secret(commitment_seed_ref, dx);
2313         return (long)ret;
2314 }
2315
2316 JNIEXPORT void JNICALL TxCreationKeysfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2317         LDKTxCreationKeys this_ptr_conv = *(LDKTxCreationKeys*)this_ptr;
2318         return TxCreationKeys_free(this_ptr_conv);
2319 }
2320
2321 JNIEXPORT jlong JNICALL TxCreationKeysgetpercommitmentpoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
2322         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
2323         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2324         *ret = TxCreationKeys_get_per_commitment_point(this_ptr_conv);
2325         return (long)ret;
2326 }
2327
2328 JNIEXPORT void JNICALL TxCreationKeyssetpercommitmentpoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2329         LDKTxCreationKeys* this_ptr_conv = (LDKTxCreationKeys*)this_ptr;
2330         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2331         return TxCreationKeys_set_per_commitment_point(this_ptr_conv, val_conv);
2332 }
2333
2334 JNIEXPORT jlong JNICALL TxCreationKeyswrite(JNIEnv * _env, jclass _b, jlong obj) {
2335         LDKTxCreationKeys* obj_conv = (LDKTxCreationKeys*)obj;
2336         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2337         *ret = TxCreationKeys_write(obj_conv);
2338         return (long)ret;
2339 }
2340
2341 JNIEXPORT jlong JNICALL TxCreationKeysread(JNIEnv * _env, jclass _b, jlong ser) {
2342         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2343         LDKTxCreationKeys* ret = malloc(sizeof(LDKTxCreationKeys));
2344         *ret = TxCreationKeys_read(ser_conv);
2345         return (long)ret;
2346 }
2347
2348 JNIEXPORT void JNICALL ChannelPublicKeysfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2349         LDKChannelPublicKeys this_ptr_conv = *(LDKChannelPublicKeys*)this_ptr;
2350         return ChannelPublicKeys_free(this_ptr_conv);
2351 }
2352
2353 JNIEXPORT jlong JNICALL ChannelPublicKeysgetfundingpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
2354         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2355         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2356         *ret = ChannelPublicKeys_get_funding_pubkey(this_ptr_conv);
2357         return (long)ret;
2358 }
2359
2360 JNIEXPORT void JNICALL ChannelPublicKeyssetfundingpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2361         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2362         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2363         return ChannelPublicKeys_set_funding_pubkey(this_ptr_conv, val_conv);
2364 }
2365
2366 JNIEXPORT jlong JNICALL ChannelPublicKeysgetrevocationbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
2367         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2368         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2369         *ret = ChannelPublicKeys_get_revocation_basepoint(this_ptr_conv);
2370         return (long)ret;
2371 }
2372
2373 JNIEXPORT void JNICALL ChannelPublicKeyssetrevocationbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2374         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2375         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2376         return ChannelPublicKeys_set_revocation_basepoint(this_ptr_conv, val_conv);
2377 }
2378
2379 JNIEXPORT jlong JNICALL ChannelPublicKeysgetpaymentpoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
2380         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2381         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2382         *ret = ChannelPublicKeys_get_payment_point(this_ptr_conv);
2383         return (long)ret;
2384 }
2385
2386 JNIEXPORT void JNICALL ChannelPublicKeyssetpaymentpoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2387         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2388         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2389         return ChannelPublicKeys_set_payment_point(this_ptr_conv, val_conv);
2390 }
2391
2392 JNIEXPORT jlong JNICALL ChannelPublicKeysgetdelayedpaymentbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
2393         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2394         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2395         *ret = ChannelPublicKeys_get_delayed_payment_basepoint(this_ptr_conv);
2396         return (long)ret;
2397 }
2398
2399 JNIEXPORT void JNICALL ChannelPublicKeyssetdelayedpaymentbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2400         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2401         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2402         return ChannelPublicKeys_set_delayed_payment_basepoint(this_ptr_conv, val_conv);
2403 }
2404
2405 JNIEXPORT jlong JNICALL ChannelPublicKeysgethtlcbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr) {
2406         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2407         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2408         *ret = ChannelPublicKeys_get_htlc_basepoint(this_ptr_conv);
2409         return (long)ret;
2410 }
2411
2412 JNIEXPORT void JNICALL ChannelPublicKeyssethtlcbasepoint(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2413         LDKChannelPublicKeys* this_ptr_conv = (LDKChannelPublicKeys*)this_ptr;
2414         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2415         return ChannelPublicKeys_set_htlc_basepoint(this_ptr_conv, val_conv);
2416 }
2417
2418 JNIEXPORT jlong JNICALL ChannelPublicKeysnew(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) {
2419         LDKPublicKey funding_pubkey_arg_conv = *(LDKPublicKey*)funding_pubkey_arg;
2420         LDKPublicKey revocation_basepoint_arg_conv = *(LDKPublicKey*)revocation_basepoint_arg;
2421         LDKPublicKey payment_point_arg_conv = *(LDKPublicKey*)payment_point_arg;
2422         LDKPublicKey delayed_payment_basepoint_arg_conv = *(LDKPublicKey*)delayed_payment_basepoint_arg;
2423         LDKPublicKey htlc_basepoint_arg_conv = *(LDKPublicKey*)htlc_basepoint_arg;
2424         LDKChannelPublicKeys* ret = malloc(sizeof(LDKChannelPublicKeys));
2425         *ret = ChannelPublicKeys_new(funding_pubkey_arg_conv, revocation_basepoint_arg_conv, payment_point_arg_conv, delayed_payment_basepoint_arg_conv, htlc_basepoint_arg_conv);
2426         return (long)ret;
2427 }
2428
2429 JNIEXPORT jlong JNICALL ChannelPublicKeyswrite(JNIEnv * _env, jclass _b, jlong obj) {
2430         LDKChannelPublicKeys* obj_conv = (LDKChannelPublicKeys*)obj;
2431         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2432         *ret = ChannelPublicKeys_write(obj_conv);
2433         return (long)ret;
2434 }
2435
2436 JNIEXPORT jlong JNICALL ChannelPublicKeysread(JNIEnv * _env, jclass _b, jlong ser) {
2437         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2438         LDKChannelPublicKeys* ret = malloc(sizeof(LDKChannelPublicKeys));
2439         *ret = ChannelPublicKeys_read(ser_conv);
2440         return (long)ret;
2441 }
2442
2443 JNIEXPORT jlong JNICALL getrevokeableredeemscript(JNIEnv * _env, jclass _b, jlong revocation_key, jlong to_self_delay, jlong delayed_payment_key) {
2444         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
2445         uint16_t to_self_delay_conv = *(uint16_t*)to_self_delay;
2446         LDKPublicKey delayed_payment_key_conv = *(LDKPublicKey*)delayed_payment_key;
2447         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2448         *ret = get_revokeable_redeemscript(revocation_key_conv, to_self_delay_conv, delayed_payment_key_conv);
2449         return (long)ret;
2450 }
2451
2452 JNIEXPORT void JNICALL HTLCOutputInCommitmentfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2453         LDKHTLCOutputInCommitment this_ptr_conv = *(LDKHTLCOutputInCommitment*)this_ptr;
2454         return HTLCOutputInCommitment_free(this_ptr_conv);
2455 }
2456
2457 JNIEXPORT jboolean JNICALL HTLCOutputInCommitmentgetoffered(JNIEnv * _env, jclass _b, jlong this_ptr) {
2458         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2459         return HTLCOutputInCommitment_get_offered(this_ptr_conv);
2460 }
2461
2462 JNIEXPORT void JNICALL HTLCOutputInCommitmentsetoffered(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
2463         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2464         return HTLCOutputInCommitment_set_offered(this_ptr_conv, va);
2465 }
2466
2467 JNIEXPORT jlong JNICALL HTLCOutputInCommitmentgetamountmsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2468         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2469         return HTLCOutputInCommitment_get_amount_msat(this_ptr_conv);
2470 }
2471
2472 JNIEXPORT void JNICALL HTLCOutputInCommitmentsetamountmsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2473         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2474         return HTLCOutputInCommitment_set_amount_msat(this_ptr_conv, val);
2475 }
2476
2477 JNIEXPORT jint JNICALL HTLCOutputInCommitmentgetcltvexpiry(JNIEnv * _env, jclass _b, jlong this_ptr) {
2478         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2479         return HTLCOutputInCommitment_get_cltv_expiry(this_ptr_conv);
2480 }
2481
2482 JNIEXPORT void JNICALL HTLCOutputInCommitmentsetcltvexpiry(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2483         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2484         return HTLCOutputInCommitment_set_cltv_expiry(this_ptr_conv, val);
2485 }
2486
2487 JNIEXPORT jbyteArray  JNICALL HTLCOutputInCommitmentgetpaymenthash(JNIEnv * _env, jclass _b, jlong this_ptr) {
2488         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2489         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
2490         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *HTLCOutputInCommitment_get_payment_hash(this_ptr_conv));
2491         return ret_arr;
2492 }
2493
2494 JNIEXPORT void JNICALL HTLCOutputInCommitmentsetpaymenthash(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2495         LDKHTLCOutputInCommitment* this_ptr_conv = (LDKHTLCOutputInCommitment*)this_ptr;
2496         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
2497         return HTLCOutputInCommitment_set_payment_hash(this_ptr_conv, val_conv);
2498 }
2499
2500 JNIEXPORT jlong JNICALL HTLCOutputInCommitmentwrite(JNIEnv * _env, jclass _b, jlong obj) {
2501         LDKHTLCOutputInCommitment* obj_conv = (LDKHTLCOutputInCommitment*)obj;
2502         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2503         *ret = HTLCOutputInCommitment_write(obj_conv);
2504         return (long)ret;
2505 }
2506
2507 JNIEXPORT jlong JNICALL HTLCOutputInCommitmentread(JNIEnv * _env, jclass _b, jlong ser) {
2508         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2509         LDKHTLCOutputInCommitment* ret = malloc(sizeof(LDKHTLCOutputInCommitment));
2510         *ret = HTLCOutputInCommitment_read(ser_conv);
2511         return (long)ret;
2512 }
2513
2514 JNIEXPORT jlong JNICALL gethtlcredeemscript(JNIEnv * _env, jclass _b, jlong htlc, jlong keys) {
2515         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
2516         LDKTxCreationKeys* keys_conv = (LDKTxCreationKeys*)keys;
2517         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2518         *ret = get_htlc_redeemscript(htlc_conv, keys_conv);
2519         return (long)ret;
2520 }
2521
2522 JNIEXPORT jlong JNICALL makefundingredeemscript(JNIEnv * _env, jclass _b, jlong a, jlong b) {
2523         LDKPublicKey a_conv = *(LDKPublicKey*)a;
2524         LDKPublicKey b_conv = *(LDKPublicKey*)b;
2525         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2526         *ret = make_funding_redeemscript(a_conv, b_conv);
2527         return (long)ret;
2528 }
2529
2530 JNIEXPORT jlong JNICALL buildhtlctransaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jlong to_self_delay, jlong htlc, jlong a_delayed_payment_key, jlong revocation_key) {
2531         unsigned char prev_hash_arr[32];
2532         (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
2533         unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
2534         uint16_t to_self_delay_conv = *(uint16_t*)to_self_delay;
2535         LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
2536         LDKPublicKey a_delayed_payment_key_conv = *(LDKPublicKey*)a_delayed_payment_key;
2537         LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
2538         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2539         *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, to_self_delay_conv, htlc_conv, a_delayed_payment_key_conv, revocation_key_conv);
2540         return (long)ret;
2541 }
2542
2543 JNIEXPORT void JNICALL LocalCommitmentTransactionfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2544         LDKLocalCommitmentTransaction this_ptr_conv = *(LDKLocalCommitmentTransaction*)this_ptr;
2545         return LocalCommitmentTransaction_free(this_ptr_conv);
2546 }
2547
2548 JNIEXPORT jlong JNICALL LocalCommitmentTransactiongetunsignedtx(JNIEnv * _env, jclass _b, jlong this_ptr) {
2549         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2550         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2551         *ret = LocalCommitmentTransaction_get_unsigned_tx(this_ptr_conv);
2552         return (long)ret;
2553 }
2554
2555 JNIEXPORT void JNICALL LocalCommitmentTransactionsetunsignedtx(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2556         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2557         LDKCVec_u8Z val_conv = *(LDKCVec_u8Z*)val;
2558         return LocalCommitmentTransaction_set_unsigned_tx(this_ptr_conv, val_conv);
2559 }
2560
2561 JNIEXPORT jlong JNICALL LocalCommitmentTransactiongettheirsig(JNIEnv * _env, jclass _b, jlong this_ptr) {
2562         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2563         LDKSignature* ret = malloc(sizeof(LDKSignature));
2564         *ret = LocalCommitmentTransaction_get_their_sig(this_ptr_conv);
2565         return (long)ret;
2566 }
2567
2568 JNIEXPORT void JNICALL LocalCommitmentTransactionsettheirsig(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2569         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2570         LDKSignature val_conv = *(LDKSignature*)val;
2571         return LocalCommitmentTransaction_set_their_sig(this_ptr_conv, val_conv);
2572 }
2573
2574 JNIEXPORT jlong JNICALL LocalCommitmentTransactiongetlocalkeys(JNIEnv * _env, jclass _b, jlong this_ptr) {
2575         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2576         LDKTxCreationKeys* ret = malloc(sizeof(LDKTxCreationKeys));
2577         *ret = LocalCommitmentTransaction_get_local_keys(this_ptr_conv);
2578         return (long)ret;
2579 }
2580
2581 JNIEXPORT void JNICALL LocalCommitmentTransactionsetlocalkeys(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2582         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2583         LDKTxCreationKeys val_conv = *(LDKTxCreationKeys*)val;
2584         return LocalCommitmentTransaction_set_local_keys(this_ptr_conv, val_conv);
2585 }
2586
2587 JNIEXPORT jint JNICALL LocalCommitmentTransactiongetfeerateperkw(JNIEnv * _env, jclass _b, jlong this_ptr) {
2588         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2589         return LocalCommitmentTransaction_get_feerate_per_kw(this_ptr_conv);
2590 }
2591
2592 JNIEXPORT void JNICALL LocalCommitmentTransactionsetfeerateperkw(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2593         LDKLocalCommitmentTransaction* this_ptr_conv = (LDKLocalCommitmentTransaction*)this_ptr;
2594         return LocalCommitmentTransaction_set_feerate_per_kw(this_ptr_conv, val);
2595 }
2596
2597 JNIEXPORT jlong JNICALL LocalCommitmentTransactiontxid(JNIEnv * _env, jclass _b, jlong this_arg) {
2598         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
2599         LDKThirtyTwoBytes* ret = malloc(sizeof(LDKThirtyTwoBytes));
2600         *ret = LocalCommitmentTransaction_txid(this_arg_conv);
2601         return (long)ret;
2602 }
2603
2604 JNIEXPORT jlong JNICALL LocalCommitmentTransactiongetlocalsig(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray funding_key, jlong funding_redeemscript, jlong channel_value_satoshis) {
2605         LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
2606         unsigned char funding_key_arr[32];
2607         (*_env)->GetByteArrayRegion (_env, funding_key, 0, 32, funding_key_arr);
2608         unsigned char (*funding_key_ref)[32] = &funding_key_arr;
2609         LDKu8slice funding_redeemscript_conv = *(LDKu8slice*)funding_redeemscript;
2610         LDKSignature* ret = malloc(sizeof(LDKSignature));
2611         *ret = LocalCommitmentTransaction_get_local_sig(this_arg_conv, funding_key_ref, funding_redeemscript_conv, channel_value_satoshis);
2612         return (long)ret;
2613 }
2614
2615 JNIEXPORT jlong JNICALL LocalCommitmentTransactionwrite(JNIEnv * _env, jclass _b, jlong obj) {
2616         LDKLocalCommitmentTransaction* obj_conv = (LDKLocalCommitmentTransaction*)obj;
2617         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2618         *ret = LocalCommitmentTransaction_write(obj_conv);
2619         return (long)ret;
2620 }
2621
2622 JNIEXPORT jlong JNICALL LocalCommitmentTransactionread(JNIEnv * _env, jclass _b, jlong ser) {
2623         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2624         LDKLocalCommitmentTransaction* ret = malloc(sizeof(LDKLocalCommitmentTransaction));
2625         *ret = LocalCommitmentTransaction_read(ser_conv);
2626         return (long)ret;
2627 }
2628
2629 JNIEXPORT void JNICALL InitFeaturesfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2630         LDKInitFeatures this_ptr_conv = *(LDKInitFeatures*)this_ptr;
2631         return InitFeatures_free(this_ptr_conv);
2632 }
2633
2634 JNIEXPORT void JNICALL NodeFeaturesfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2635         LDKNodeFeatures this_ptr_conv = *(LDKNodeFeatures*)this_ptr;
2636         return NodeFeatures_free(this_ptr_conv);
2637 }
2638
2639 JNIEXPORT void JNICALL ChannelFeaturesfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2640         LDKChannelFeatures this_ptr_conv = *(LDKChannelFeatures*)this_ptr;
2641         return ChannelFeatures_free(this_ptr_conv);
2642 }
2643
2644 JNIEXPORT void JNICALL RouteHopfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2645         LDKRouteHop this_ptr_conv = *(LDKRouteHop*)this_ptr;
2646         return RouteHop_free(this_ptr_conv);
2647 }
2648
2649 JNIEXPORT jlong JNICALL RouteHopgetpubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
2650         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2651         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2652         *ret = RouteHop_get_pubkey(this_ptr_conv);
2653         return (long)ret;
2654 }
2655
2656 JNIEXPORT void JNICALL RouteHopsetpubkey(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2657         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2658         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2659         return RouteHop_set_pubkey(this_ptr_conv, val_conv);
2660 }
2661
2662 JNIEXPORT jlong JNICALL RouteHopgetshortchannelid(JNIEnv * _env, jclass _b, jlong this_ptr) {
2663         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2664         return RouteHop_get_short_channel_id(this_ptr_conv);
2665 }
2666
2667 JNIEXPORT void JNICALL RouteHopsetshortchannelid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2668         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2669         return RouteHop_set_short_channel_id(this_ptr_conv, val);
2670 }
2671
2672 JNIEXPORT jlong JNICALL RouteHopgetfeemsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2673         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2674         return RouteHop_get_fee_msat(this_ptr_conv);
2675 }
2676
2677 JNIEXPORT void JNICALL RouteHopsetfeemsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2678         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2679         return RouteHop_set_fee_msat(this_ptr_conv, val);
2680 }
2681
2682 JNIEXPORT jint JNICALL RouteHopgetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr) {
2683         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2684         return RouteHop_get_cltv_expiry_delta(this_ptr_conv);
2685 }
2686
2687 JNIEXPORT void JNICALL RouteHopsetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2688         LDKRouteHop* this_ptr_conv = (LDKRouteHop*)this_ptr;
2689         return RouteHop_set_cltv_expiry_delta(this_ptr_conv, val);
2690 }
2691
2692 JNIEXPORT void JNICALL Routefree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2693         LDKRoute this_ptr_conv = *(LDKRoute*)this_ptr;
2694         return Route_free(this_ptr_conv);
2695 }
2696
2697 JNIEXPORT void JNICALL Routesetpaths(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2698         LDKRoute* this_ptr_conv = (LDKRoute*)this_ptr;
2699         LDKCVec_CVec_RouteHopZZ val_conv = *(LDKCVec_CVec_RouteHopZZ*)val;
2700         return Route_set_paths(this_ptr_conv, val_conv);
2701 }
2702
2703 JNIEXPORT jlong JNICALL Routenew(JNIEnv * _env, jclass _b, jlong paths_arg) {
2704         LDKCVec_CVec_RouteHopZZ paths_arg_conv = *(LDKCVec_CVec_RouteHopZZ*)paths_arg;
2705         LDKRoute* ret = malloc(sizeof(LDKRoute));
2706         *ret = Route_new(paths_arg_conv);
2707         return (long)ret;
2708 }
2709
2710 JNIEXPORT jlong JNICALL Routewrite(JNIEnv * _env, jclass _b, jlong obj) {
2711         LDKRoute* obj_conv = (LDKRoute*)obj;
2712         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2713         *ret = Route_write(obj_conv);
2714         return (long)ret;
2715 }
2716
2717 JNIEXPORT jlong JNICALL Routeread(JNIEnv * _env, jclass _b, jlong ser) {
2718         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2719         LDKRoute* ret = malloc(sizeof(LDKRoute));
2720         *ret = Route_read(ser_conv);
2721         return (long)ret;
2722 }
2723
2724 JNIEXPORT void JNICALL RouteHintfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2725         LDKRouteHint this_ptr_conv = *(LDKRouteHint*)this_ptr;
2726         return RouteHint_free(this_ptr_conv);
2727 }
2728
2729 JNIEXPORT jlong JNICALL RouteHintgetsrcnodeid(JNIEnv * _env, jclass _b, jlong this_ptr) {
2730         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2731         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2732         *ret = RouteHint_get_src_node_id(this_ptr_conv);
2733         return (long)ret;
2734 }
2735
2736 JNIEXPORT void JNICALL RouteHintsetsrcnodeid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2737         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2738         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2739         return RouteHint_set_src_node_id(this_ptr_conv, val_conv);
2740 }
2741
2742 JNIEXPORT jlong JNICALL RouteHintgetshortchannelid(JNIEnv * _env, jclass _b, jlong this_ptr) {
2743         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2744         return RouteHint_get_short_channel_id(this_ptr_conv);
2745 }
2746
2747 JNIEXPORT void JNICALL RouteHintsetshortchannelid(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2748         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2749         return RouteHint_set_short_channel_id(this_ptr_conv, val);
2750 }
2751
2752 JNIEXPORT jlong JNICALL RouteHintgetfees(JNIEnv * _env, jclass _b, jlong this_ptr) {
2753         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2754         LDKRoutingFees* ret = malloc(sizeof(LDKRoutingFees));
2755         *ret = RouteHint_get_fees(this_ptr_conv);
2756         return (long)ret;
2757 }
2758
2759 JNIEXPORT void JNICALL RouteHintsetfees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2760         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2761         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
2762         return RouteHint_set_fees(this_ptr_conv, val_conv);
2763 }
2764
2765 JNIEXPORT jlong JNICALL RouteHintgetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr) {
2766         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2767         uint16_t* ret = malloc(sizeof(uint16_t));
2768         *ret = RouteHint_get_cltv_expiry_delta(this_ptr_conv);
2769         return (long)ret;
2770 }
2771
2772 JNIEXPORT void JNICALL RouteHintsetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2773         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2774         uint16_t val_conv = *(uint16_t*)val;
2775         return RouteHint_set_cltv_expiry_delta(this_ptr_conv, val_conv);
2776 }
2777
2778 JNIEXPORT jlong JNICALL RouteHintgethtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2779         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2780         return RouteHint_get_htlc_minimum_msat(this_ptr_conv);
2781 }
2782
2783 JNIEXPORT void JNICALL RouteHintsethtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2784         LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
2785         return RouteHint_set_htlc_minimum_msat(this_ptr_conv, val);
2786 }
2787
2788 JNIEXPORT jlong JNICALL RouteHintnew(JNIEnv * _env, jclass _b, jlong src_node_id_arg, jlong short_channel_id_arg, jlong fees_arg, jlong cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
2789         LDKPublicKey src_node_id_arg_conv = *(LDKPublicKey*)src_node_id_arg;
2790         LDKRoutingFees fees_arg_conv = *(LDKRoutingFees*)fees_arg;
2791         uint16_t cltv_expiry_delta_arg_conv = *(uint16_t*)cltv_expiry_delta_arg;
2792         LDKRouteHint* ret = malloc(sizeof(LDKRouteHint));
2793         *ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg_conv, htlc_minimum_msat_arg);
2794         return (long)ret;
2795 }
2796
2797 JNIEXPORT jlong JNICALL getroute(JNIEnv * _env, jclass _b, jlong our_node_id, jlong network, jlong target, jlong first_hops, jlong last_hops, jlong final_value_msa, jint final_cltv, jlong logger) {
2798         LDKPublicKey our_node_id_conv = *(LDKPublicKey*)our_node_id;
2799         LDKNetworkGraph* network_conv = (LDKNetworkGraph*)network;
2800         LDKPublicKey target_conv = *(LDKPublicKey*)target;
2801         LDKCChannelDetailsSlice* first_hops_conv = (LDKCChannelDetailsSlice*)first_hops;
2802         LDKCRouteHintSlice last_hops_conv = *(LDKCRouteHintSlice*)last_hops;
2803         LDKLogger logger_conv = *(LDKLogger*)logger;
2804         LDKCResult_RouteLightningErrorZ* ret = malloc(sizeof(LDKCResult_RouteLightningErrorZ));
2805         *ret = get_route(our_node_id_conv, network_conv, target_conv, first_hops_conv, last_hops_conv, final_value_msa, final_cltv, logger_conv);
2806         return (long)ret;
2807 }
2808
2809 JNIEXPORT void JNICALL NetworkGraphfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2810         LDKNetworkGraph this_ptr_conv = *(LDKNetworkGraph*)this_ptr;
2811         return NetworkGraph_free(this_ptr_conv);
2812 }
2813
2814 JNIEXPORT void JNICALL NetGraphMsgHandlerfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2815         LDKNetGraphMsgHandler this_ptr_conv = *(LDKNetGraphMsgHandler*)this_ptr;
2816         return NetGraphMsgHandler_free(this_ptr_conv);
2817 }
2818
2819 JNIEXPORT jlong JNICALL NetGraphMsgHandlernew(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger) {
2820         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
2821         LDKLogger logger_conv = *(LDKLogger*)logger;
2822         LDKNetGraphMsgHandler* ret = malloc(sizeof(LDKNetGraphMsgHandler));
2823         *ret = NetGraphMsgHandler_new(chain_monitor_conv, logger_conv);
2824         return (long)ret;
2825 }
2826
2827 JNIEXPORT jlong JNICALL NetGraphMsgHandlerfromnetgraph(JNIEnv * _env, jclass _b, jlong chain_monitor, jlong logger, jlong network_graph) {
2828         LDKChainWatchInterface chain_monitor_conv = *(LDKChainWatchInterface*)chain_monitor;
2829         LDKLogger logger_conv = *(LDKLogger*)logger;
2830         LDKNetworkGraph network_graph_conv = *(LDKNetworkGraph*)network_graph;
2831         LDKNetGraphMsgHandler* ret = malloc(sizeof(LDKNetGraphMsgHandler));
2832         *ret = NetGraphMsgHandler_from_net_graph(chain_monitor_conv, logger_conv, network_graph_conv);
2833         return (long)ret;
2834 }
2835
2836 JNIEXPORT jlong JNICALL NetGraphMsgHandlerasRoutingMessageHandler(JNIEnv * _env, jclass _b, jlong this_arg) {
2837         LDKNetGraphMsgHandler* this_arg_conv = (LDKNetGraphMsgHandler*)this_arg;
2838         LDKRoutingMessageHandler* ret = malloc(sizeof(LDKRoutingMessageHandler));
2839         *ret = NetGraphMsgHandler_as_RoutingMessageHandler(this_arg_conv);
2840         return (long)ret;
2841 }
2842
2843 JNIEXPORT void JNICALL DirectionalChannelInfofree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2844         LDKDirectionalChannelInfo this_ptr_conv = *(LDKDirectionalChannelInfo*)this_ptr;
2845         return DirectionalChannelInfo_free(this_ptr_conv);
2846 }
2847
2848 JNIEXPORT jint JNICALL DirectionalChannelInfogetlastupdate(JNIEnv * _env, jclass _b, jlong this_ptr) {
2849         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2850         return DirectionalChannelInfo_get_last_update(this_ptr_conv);
2851 }
2852
2853 JNIEXPORT void JNICALL DirectionalChannelInfosetlastupdate(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2854         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2855         return DirectionalChannelInfo_set_last_update(this_ptr_conv, val);
2856 }
2857
2858 JNIEXPORT jboolean JNICALL DirectionalChannelInfogetenabled(JNIEnv * _env, jclass _b, jlong this_ptr) {
2859         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2860         return DirectionalChannelInfo_get_enabled(this_ptr_conv);
2861 }
2862
2863 JNIEXPORT void JNICALL DirectionalChannelInfosetenabled(JNIEnv * _env, jclass _b, jlong this_ptr, jboolean va) {
2864         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2865         return DirectionalChannelInfo_set_enabled(this_ptr_conv, va);
2866 }
2867
2868 JNIEXPORT jlong JNICALL DirectionalChannelInfogetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr) {
2869         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2870         uint16_t* ret = malloc(sizeof(uint16_t));
2871         *ret = DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr_conv);
2872         return (long)ret;
2873 }
2874
2875 JNIEXPORT void JNICALL DirectionalChannelInfosetcltvexpirydelta(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2876         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2877         uint16_t val_conv = *(uint16_t*)val;
2878         return DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr_conv, val_conv);
2879 }
2880
2881 JNIEXPORT jlong JNICALL DirectionalChannelInfogethtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2882         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2883         return DirectionalChannelInfo_get_htlc_minimum_msat(this_ptr_conv);
2884 }
2885
2886 JNIEXPORT void JNICALL DirectionalChannelInfosethtlcminimummsat(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2887         LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
2888         return DirectionalChannelInfo_set_htlc_minimum_msat(this_ptr_conv, val);
2889 }
2890
2891 JNIEXPORT jlong JNICALL DirectionalChannelInfowrite(JNIEnv * _env, jclass _b, jlong obj) {
2892         LDKDirectionalChannelInfo* obj_conv = (LDKDirectionalChannelInfo*)obj;
2893         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2894         *ret = DirectionalChannelInfo_write(obj_conv);
2895         return (long)ret;
2896 }
2897
2898 JNIEXPORT jlong JNICALL DirectionalChannelInforead(JNIEnv * _env, jclass _b, jlong ser) {
2899         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2900         LDKDirectionalChannelInfo* ret = malloc(sizeof(LDKDirectionalChannelInfo));
2901         *ret = DirectionalChannelInfo_read(ser_conv);
2902         return (long)ret;
2903 }
2904
2905 JNIEXPORT void JNICALL ChannelInfofree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2906         LDKChannelInfo this_ptr_conv = *(LDKChannelInfo*)this_ptr;
2907         return ChannelInfo_free(this_ptr_conv);
2908 }
2909
2910 JNIEXPORT jlong JNICALL ChannelInfogetnodeone(JNIEnv * _env, jclass _b, jlong this_ptr) {
2911         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2912         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2913         *ret = ChannelInfo_get_node_one(this_ptr_conv);
2914         return (long)ret;
2915 }
2916
2917 JNIEXPORT void JNICALL ChannelInfosetnodeone(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2918         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2919         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2920         return ChannelInfo_set_node_one(this_ptr_conv, val_conv);
2921 }
2922
2923 JNIEXPORT jlong JNICALL ChannelInfogetonetotwo(JNIEnv * _env, jclass _b, jlong this_ptr) {
2924         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2925         LDKDirectionalChannelInfo* ret = malloc(sizeof(LDKDirectionalChannelInfo));
2926         *ret = ChannelInfo_get_one_to_two(this_ptr_conv);
2927         return (long)ret;
2928 }
2929
2930 JNIEXPORT void JNICALL ChannelInfosetonetotwo(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2931         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2932         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
2933         return ChannelInfo_set_one_to_two(this_ptr_conv, val_conv);
2934 }
2935
2936 JNIEXPORT jlong JNICALL ChannelInfogetnodetwo(JNIEnv * _env, jclass _b, jlong this_ptr) {
2937         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2938         LDKPublicKey* ret = malloc(sizeof(LDKPublicKey));
2939         *ret = ChannelInfo_get_node_two(this_ptr_conv);
2940         return (long)ret;
2941 }
2942
2943 JNIEXPORT void JNICALL ChannelInfosetnodetwo(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2944         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2945         LDKPublicKey val_conv = *(LDKPublicKey*)val;
2946         return ChannelInfo_set_node_two(this_ptr_conv, val_conv);
2947 }
2948
2949 JNIEXPORT jlong JNICALL ChannelInfogettwotoone(JNIEnv * _env, jclass _b, jlong this_ptr) {
2950         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2951         LDKDirectionalChannelInfo* ret = malloc(sizeof(LDKDirectionalChannelInfo));
2952         *ret = ChannelInfo_get_two_to_one(this_ptr_conv);
2953         return (long)ret;
2954 }
2955
2956 JNIEXPORT void JNICALL ChannelInfosettwotoone(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
2957         LDKChannelInfo* this_ptr_conv = (LDKChannelInfo*)this_ptr;
2958         LDKDirectionalChannelInfo val_conv = *(LDKDirectionalChannelInfo*)val;
2959         return ChannelInfo_set_two_to_one(this_ptr_conv, val_conv);
2960 }
2961
2962 JNIEXPORT jlong JNICALL ChannelInfowrite(JNIEnv * _env, jclass _b, jlong obj) {
2963         LDKChannelInfo* obj_conv = (LDKChannelInfo*)obj;
2964         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
2965         *ret = ChannelInfo_write(obj_conv);
2966         return (long)ret;
2967 }
2968
2969 JNIEXPORT jlong JNICALL ChannelInforead(JNIEnv * _env, jclass _b, jlong ser) {
2970         LDKu8slice ser_conv = *(LDKu8slice*)ser;
2971         LDKChannelInfo* ret = malloc(sizeof(LDKChannelInfo));
2972         *ret = ChannelInfo_read(ser_conv);
2973         return (long)ret;
2974 }
2975
2976 JNIEXPORT void JNICALL RoutingFeesfree(JNIEnv * _env, jclass _b, jlong this_ptr) {
2977         LDKRoutingFees this_ptr_conv = *(LDKRoutingFees*)this_ptr;
2978         return RoutingFees_free(this_ptr_conv);
2979 }
2980
2981 JNIEXPORT jint JNICALL RoutingFeesgetbasemsat(JNIEnv * _env, jclass _b, jlong this_ptr) {
2982         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
2983         return RoutingFees_get_base_msat(this_ptr_conv);
2984 }
2985
2986 JNIEXPORT void JNICALL RoutingFeessetbasemsat(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2987         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
2988         return RoutingFees_set_base_msat(this_ptr_conv, val);
2989 }
2990
2991 JNIEXPORT jint JNICALL RoutingFeesgetproportionalmillionths(JNIEnv * _env, jclass _b, jlong this_ptr) {
2992         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
2993         return RoutingFees_get_proportional_millionths(this_ptr_conv);
2994 }
2995
2996 JNIEXPORT void JNICALL RoutingFeessetproportionalmillionths(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
2997         LDKRoutingFees* this_ptr_conv = (LDKRoutingFees*)this_ptr;
2998         return RoutingFees_set_proportional_millionths(this_ptr_conv, val);
2999 }
3000
3001 JNIEXPORT jlong JNICALL RoutingFeesnew(JNIEnv * _env, jclass _b, jint base_msat_arg, jint proportional_millionths_arg) {
3002         LDKRoutingFees* ret = malloc(sizeof(LDKRoutingFees));
3003         *ret = RoutingFees_new(base_msat_arg, proportional_millionths_arg);
3004         return (long)ret;
3005 }
3006
3007 JNIEXPORT jlong JNICALL RoutingFeesread(JNIEnv * _env, jclass _b, jlong ser) {
3008         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3009         LDKRoutingFees* ret = malloc(sizeof(LDKRoutingFees));
3010         *ret = RoutingFees_read(ser_conv);
3011         return (long)ret;
3012 }
3013
3014 JNIEXPORT jlong JNICALL RoutingFeeswrite(JNIEnv * _env, jclass _b, jlong obj) {
3015         LDKRoutingFees* obj_conv = (LDKRoutingFees*)obj;
3016         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
3017         *ret = RoutingFees_write(obj_conv);
3018         return (long)ret;
3019 }
3020
3021 JNIEXPORT void JNICALL NodeAnnouncementInfofree(JNIEnv * _env, jclass _b, jlong this_ptr) {
3022         LDKNodeAnnouncementInfo this_ptr_conv = *(LDKNodeAnnouncementInfo*)this_ptr;
3023         return NodeAnnouncementInfo_free(this_ptr_conv);
3024 }
3025
3026 JNIEXPORT jint JNICALL NodeAnnouncementInfogetlastupdate(JNIEnv * _env, jclass _b, jlong this_ptr) {
3027         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3028         return NodeAnnouncementInfo_get_last_update(this_ptr_conv);
3029 }
3030
3031 JNIEXPORT void JNICALL NodeAnnouncementInfosetlastupdate(JNIEnv * _env, jclass _b, jlong this_ptr, jint val) {
3032         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3033         return NodeAnnouncementInfo_set_last_update(this_ptr_conv, val);
3034 }
3035
3036 JNIEXPORT jbyteArray  JNICALL NodeAnnouncementInfogetrgb(JNIEnv * _env, jclass _b, jlong this_ptr) {
3037         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3038         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
3039         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 3, *NodeAnnouncementInfo_get_rgb(this_ptr_conv));
3040         return ret_arr;
3041 }
3042
3043 JNIEXPORT void JNICALL NodeAnnouncementInfosetrgb(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3044         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3045         LDKThreeBytes val_conv = *(LDKThreeBytes*)val;
3046         return NodeAnnouncementInfo_set_rgb(this_ptr_conv, val_conv);
3047 }
3048
3049 JNIEXPORT jbyteArray  JNICALL NodeAnnouncementInfogetalias(JNIEnv * _env, jclass _b, jlong this_ptr) {
3050         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3051         jbyteArray ret_arr = (*_env)->NewByteArray(_env, 0); // XXX: len 0
3052         (*_env)->SetByteArrayRegion(_env, ret_arr, 0, 32, *NodeAnnouncementInfo_get_alias(this_ptr_conv));
3053         return ret_arr;
3054 }
3055
3056 JNIEXPORT void JNICALL NodeAnnouncementInfosetalias(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3057         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3058         LDKThirtyTwoBytes val_conv = *(LDKThirtyTwoBytes*)val;
3059         return NodeAnnouncementInfo_set_alias(this_ptr_conv, val_conv);
3060 }
3061
3062 JNIEXPORT void JNICALL NodeAnnouncementInfosetaddresses(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3063         LDKNodeAnnouncementInfo* this_ptr_conv = (LDKNodeAnnouncementInfo*)this_ptr;
3064         LDKCVec_NetAddressZ val_conv = *(LDKCVec_NetAddressZ*)val;
3065         return NodeAnnouncementInfo_set_addresses(this_ptr_conv, val_conv);
3066 }
3067
3068 JNIEXPORT jlong JNICALL NodeAnnouncementInfowrite(JNIEnv * _env, jclass _b, jlong obj) {
3069         LDKNodeAnnouncementInfo* obj_conv = (LDKNodeAnnouncementInfo*)obj;
3070         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
3071         *ret = NodeAnnouncementInfo_write(obj_conv);
3072         return (long)ret;
3073 }
3074
3075 JNIEXPORT jlong JNICALL NodeAnnouncementInforead(JNIEnv * _env, jclass _b, jlong ser) {
3076         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3077         LDKNodeAnnouncementInfo* ret = malloc(sizeof(LDKNodeAnnouncementInfo));
3078         *ret = NodeAnnouncementInfo_read(ser_conv);
3079         return (long)ret;
3080 }
3081
3082 JNIEXPORT void JNICALL NodeInfofree(JNIEnv * _env, jclass _b, jlong this_ptr) {
3083         LDKNodeInfo this_ptr_conv = *(LDKNodeInfo*)this_ptr;
3084         return NodeInfo_free(this_ptr_conv);
3085 }
3086
3087 JNIEXPORT void JNICALL NodeInfosetchannels(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3088         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
3089         LDKCVec_u64Z val_conv = *(LDKCVec_u64Z*)val;
3090         return NodeInfo_set_channels(this_ptr_conv, val_conv);
3091 }
3092
3093 JNIEXPORT jlong JNICALL NodeInfogetlowestinboundchannelfees(JNIEnv * _env, jclass _b, jlong this_ptr) {
3094         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
3095         LDKRoutingFees* ret = malloc(sizeof(LDKRoutingFees));
3096         *ret = NodeInfo_get_lowest_inbound_channel_fees(this_ptr_conv);
3097         return (long)ret;
3098 }
3099
3100 JNIEXPORT void JNICALL NodeInfosetlowestinboundchannelfees(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3101         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
3102         LDKRoutingFees val_conv = *(LDKRoutingFees*)val;
3103         return NodeInfo_set_lowest_inbound_channel_fees(this_ptr_conv, val_conv);
3104 }
3105
3106 JNIEXPORT jlong JNICALL NodeInfogetannouncementinfo(JNIEnv * _env, jclass _b, jlong this_ptr) {
3107         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
3108         LDKNodeAnnouncementInfo* ret = malloc(sizeof(LDKNodeAnnouncementInfo));
3109         *ret = NodeInfo_get_announcement_info(this_ptr_conv);
3110         return (long)ret;
3111 }
3112
3113 JNIEXPORT void JNICALL NodeInfosetannouncementinfo(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
3114         LDKNodeInfo* this_ptr_conv = (LDKNodeInfo*)this_ptr;
3115         LDKNodeAnnouncementInfo val_conv = *(LDKNodeAnnouncementInfo*)val;
3116         return NodeInfo_set_announcement_info(this_ptr_conv, val_conv);
3117 }
3118
3119 JNIEXPORT jlong JNICALL NodeInfonew(JNIEnv * _env, jclass _b, jlong channels_arg, jlong lowest_inbound_channel_fees_arg, jlong announcement_info_arg) {
3120         LDKCVec_u64Z channels_arg_conv = *(LDKCVec_u64Z*)channels_arg;
3121         LDKRoutingFees lowest_inbound_channel_fees_arg_conv = *(LDKRoutingFees*)lowest_inbound_channel_fees_arg;
3122         LDKNodeAnnouncementInfo announcement_info_arg_conv = *(LDKNodeAnnouncementInfo*)announcement_info_arg;
3123         LDKNodeInfo* ret = malloc(sizeof(LDKNodeInfo));
3124         *ret = NodeInfo_new(channels_arg_conv, lowest_inbound_channel_fees_arg_conv, announcement_info_arg_conv);
3125         return (long)ret;
3126 }
3127
3128 JNIEXPORT jlong JNICALL NodeInfowrite(JNIEnv * _env, jclass _b, jlong obj) {
3129         LDKNodeInfo* obj_conv = (LDKNodeInfo*)obj;
3130         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
3131         *ret = NodeInfo_write(obj_conv);
3132         return (long)ret;
3133 }
3134
3135 JNIEXPORT jlong JNICALL NodeInforead(JNIEnv * _env, jclass _b, jlong ser) {
3136         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3137         LDKNodeInfo* ret = malloc(sizeof(LDKNodeInfo));
3138         *ret = NodeInfo_read(ser_conv);
3139         return (long)ret;
3140 }
3141
3142 JNIEXPORT jlong JNICALL NetworkGraphwrite(JNIEnv * _env, jclass _b, jlong obj) {
3143         LDKNetworkGraph* obj_conv = (LDKNetworkGraph*)obj;
3144         LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
3145         *ret = NetworkGraph_write(obj_conv);
3146         return (long)ret;
3147 }
3148
3149 JNIEXPORT jlong JNICALL NetworkGraphread(JNIEnv * _env, jclass _b, jlong ser) {
3150         LDKu8slice ser_conv = *(LDKu8slice*)ser;
3151         LDKNetworkGraph* ret = malloc(sizeof(LDKNetworkGraph));
3152         *ret = NetworkGraph_read(ser_conv);
3153         return (long)ret;
3154 }
3155
3156 JNIEXPORT jlong JNICALL NetworkGraphnew(JNIEnv * _env, jclass _b) {
3157         LDKNetworkGraph* ret = malloc(sizeof(LDKNetworkGraph));
3158         *ret = NetworkGraph_new();
3159         return (long)ret;
3160 }
3161
3162 JNIEXPORT void JNICALL NetworkGraphclosechannelfromupdate(JNIEnv * _env, jclass _b, jlong this_arg, jlong short_channel_id, jboolean is_permanent) {
3163         LDKNetworkGraph* this_arg_conv = (LDKNetworkGraph*)this_arg;
3164         return NetworkGraph_close_channel_from_update(this_arg_conv, short_channel_id, is_permanent);
3165 }
3166