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