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