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