Convert String (tested from Java!)
[ldk-java] / src / main / jni / bindings.c
index cc4fb2318cc389e90cce934d3acfff116269bf41..2bf779f46eb8d73476def841355c19cc9361bcc2 100644 (file)
@@ -28,7 +28,7 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKMessageSendEventsProvider_1
        LDKMessageSendEventsProvider_JCalls *calls = malloc(sizeof(LDKMessageSendEventsProvider_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "TODO");
+       calls->get_and_clear_pending_msg_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_msg_events", "()J");
        assert(calls->get_and_clear_pending_msg_events_meth != NULL);
 
        LDKMessageSendEventsProvider *ret = malloc(sizeof(LDKMessageSendEventsProvider));
@@ -61,7 +61,7 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKEventsProvider_1new (JNIEnv
        LDKEventsProvider_JCalls *calls = malloc(sizeof(LDKEventsProvider_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "TODO");
+       calls->get_and_clear_pending_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_events", "()J");
        assert(calls->get_and_clear_pending_events_meth != NULL);
 
        LDKEventsProvider *ret = malloc(sizeof(LDKEventsProvider));
@@ -78,7 +78,8 @@ typedef struct LDKLogger_JCalls {
 } LDKLogger_JCalls;
 void log_jcall(const void* this_arg, const char *record) {
        LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
-       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->log_meth, record);
+       jstring record_conv = (*j_calls->env)->NewStringUTF(j_calls->env, record);
+       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->log_meth, record_conv);
 }
 void LDKLogger_JCalls_free(void* this_arg) {
        LDKLogger_JCalls *j_calls = (LDKLogger_JCalls*) this_arg;
@@ -91,7 +92,7 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKLogger_1new (JNIEnv * env,
        LDKLogger_JCalls *calls = malloc(sizeof(LDKLogger_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->log_meth = (*env)->GetMethodID(env, c, "log", "TODO");
+       calls->log_meth = (*env)->GetMethodID(env, c, "log", "(Ljava/lang/String;)V");
        assert(calls->log_meth != NULL);
 
        LDKLogger *ret = malloc(sizeof(LDKLogger));
@@ -113,7 +114,9 @@ typedef struct LDKChainWatchInterface_JCalls {
 } LDKChainWatchInterface_JCalls;
 void install_watch_tx_jcall(const void* this_arg, const uint8_t (*txid)[32], LDKu8slice script_pub_key) {
        LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
-       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_tx_meth, txid, script_pub_key);
+       jbyteArray txid_arr = (*j_calls->env)->NewByteArray(j_calls->env, 32);
+       (*j_calls->env)->SetByteArrayRegion(j_calls->env, txid_arr, 0, 32, *txid);
+       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->install_watch_tx_meth, txid_arr, script_pub_key);
 }
 void install_watch_outpoint_jcall(const void* this_arg, LDKC2Tuple_Txidu32Z outpoint, LDKu8slice out_script) {
        LDKChainWatchInterface_JCalls *j_calls = (LDKChainWatchInterface_JCalls*) this_arg;
@@ -155,17 +158,17 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainWatchInterface_1new (J
        LDKChainWatchInterface_JCalls *calls = malloc(sizeof(LDKChainWatchInterface_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->install_watch_tx_meth = (*env)->GetMethodID(env, c, "install_watch_tx", "TODO");
+       calls->install_watch_tx_meth = (*env)->GetMethodID(env, c, "install_watch_tx", "([BJ)V");
        assert(calls->install_watch_tx_meth != NULL);
-       calls->install_watch_outpoint_meth = (*env)->GetMethodID(env, c, "install_watch_outpoint", "TODO");
+       calls->install_watch_outpoint_meth = (*env)->GetMethodID(env, c, "install_watch_outpoint", "(JJ)V");
        assert(calls->install_watch_outpoint_meth != NULL);
-       calls->watch_all_txn_meth = (*env)->GetMethodID(env, c, "watch_all_txn", "TODO");
+       calls->watch_all_txn_meth = (*env)->GetMethodID(env, c, "watch_all_txn", "()V");
        assert(calls->watch_all_txn_meth != NULL);
-       calls->get_chain_utxo_meth = (*env)->GetMethodID(env, c, "get_chain_utxo", "TODO");
+       calls->get_chain_utxo_meth = (*env)->GetMethodID(env, c, "get_chain_utxo", "(JJ)J");
        assert(calls->get_chain_utxo_meth != NULL);
-       calls->filter_block_meth = (*env)->GetMethodID(env, c, "filter_block", "TODO");
+       calls->filter_block_meth = (*env)->GetMethodID(env, c, "filter_block", "(J)J");
        assert(calls->filter_block_meth != NULL);
-       calls->reentered_meth = (*env)->GetMethodID(env, c, "reentered", "TODO");
+       calls->reentered_meth = (*env)->GetMethodID(env, c, "reentered", "()J");
        assert(calls->reentered_meth != NULL);
 
        LDKChainWatchInterface *ret = malloc(sizeof(LDKChainWatchInterface));
@@ -200,7 +203,7 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKBroadcasterInterface_1new (
        LDKBroadcasterInterface_JCalls *calls = malloc(sizeof(LDKBroadcasterInterface_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "TODO");
+       calls->broadcast_transaction_meth = (*env)->GetMethodID(env, c, "broadcast_transaction", "(J)V");
        assert(calls->broadcast_transaction_meth != NULL);
 
        LDKBroadcasterInterface *ret = malloc(sizeof(LDKBroadcasterInterface));
@@ -218,11 +221,15 @@ typedef struct LDKChainListener_JCalls {
 } LDKChainListener_JCalls;
 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) {
        LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
-       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_connected_meth, header, height, txn_matched, indexes_of_txn_matched);
+       jbyteArray header_arr = (*j_calls->env)->NewByteArray(j_calls->env, 80);
+       (*j_calls->env)->SetByteArrayRegion(j_calls->env, header_arr, 0, 80, *header);
+       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);
 }
 void block_disconnected_jcall(const void* this_arg, const uint8_t (*header)[80], uint32_t disconnected_height) {
        LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
-       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_disconnected_meth, header, disconnected_height);
+       jbyteArray header_arr = (*j_calls->env)->NewByteArray(j_calls->env, 80);
+       (*j_calls->env)->SetByteArrayRegion(j_calls->env, header_arr, 0, 80, *header);
+       return (*j_calls->env)->CallVoidMethod(j_calls->env, j_calls->o, j_calls->block_disconnected_meth, header_arr, disconnected_height);
 }
 void LDKChainListener_JCalls_free(void* this_arg) {
        LDKChainListener_JCalls *j_calls = (LDKChainListener_JCalls*) this_arg;
@@ -235,9 +242,9 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChainListener_1new (JNIEnv
        LDKChainListener_JCalls *calls = malloc(sizeof(LDKChainListener_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "TODO");
+       calls->block_connected_meth = (*env)->GetMethodID(env, c, "block_connected", "([BIJJ)V");
        assert(calls->block_connected_meth != NULL);
-       calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "TODO");
+       calls->block_disconnected_meth = (*env)->GetMethodID(env, c, "block_disconnected", "([BI)V");
        assert(calls->block_disconnected_meth != NULL);
 
        LDKChainListener *ret = malloc(sizeof(LDKChainListener));
@@ -268,7 +275,7 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKFeeEstimator_1new (JNIEnv *
        LDKFeeEstimator_JCalls *calls = malloc(sizeof(LDKFeeEstimator_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "TODO");
+       calls->get_est_sat_per_1000_weight_meth = (*env)->GetMethodID(env, c, "get_est_sat_per_1000_weight", "(J)I");
        assert(calls->get_est_sat_per_1000_weight_meth != NULL);
 
        LDKFeeEstimator *ret = malloc(sizeof(LDKFeeEstimator));
@@ -337,7 +344,9 @@ LDKCResult_CVec_SignatureZNoneZ sign_local_commitment_htlc_transactions_jcall(co
 }
 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) {
        LDKChannelKeys_JCalls *j_calls = (LDKChannelKeys_JCalls*) this_arg;
-       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, htlc);
+       jbyteArray per_commitment_key_arr = (*j_calls->env)->NewByteArray(j_calls->env, 32);
+       (*j_calls->env)->SetByteArrayRegion(j_calls->env, per_commitment_key_arr, 0, 32, *per_commitment_key);
+       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);
        LDKCResult_SignatureNoneZ res = *ret;
        free(ret);
        return res;
@@ -383,27 +392,27 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelKeys_1new (JNIEnv *
        LDKChannelKeys_JCalls *calls = malloc(sizeof(LDKChannelKeys_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "TODO");
+       calls->get_per_commitment_point_meth = (*env)->GetMethodID(env, c, "get_per_commitment_point", "(J)J");
        assert(calls->get_per_commitment_point_meth != NULL);
-       calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "TODO");
+       calls->release_commitment_secret_meth = (*env)->GetMethodID(env, c, "release_commitment_secret", "(J)J");
        assert(calls->release_commitment_secret_meth != NULL);
-       calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "TODO");
+       calls->key_derivation_params_meth = (*env)->GetMethodID(env, c, "key_derivation_params", "()J");
        assert(calls->key_derivation_params_meth != NULL);
-       calls->sign_remote_commitment_meth = (*env)->GetMethodID(env, c, "sign_remote_commitment", "TODO");
+       calls->sign_remote_commitment_meth = (*env)->GetMethodID(env, c, "sign_remote_commitment", "(IJJJ)J");
        assert(calls->sign_remote_commitment_meth != NULL);
-       calls->sign_local_commitment_meth = (*env)->GetMethodID(env, c, "sign_local_commitment", "TODO");
+       calls->sign_local_commitment_meth = (*env)->GetMethodID(env, c, "sign_local_commitment", "(J)J");
        assert(calls->sign_local_commitment_meth != NULL);
-       calls->sign_local_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_local_commitment_htlc_transactions", "TODO");
+       calls->sign_local_commitment_htlc_transactions_meth = (*env)->GetMethodID(env, c, "sign_local_commitment_htlc_transactions", "(J)J");
        assert(calls->sign_local_commitment_htlc_transactions_meth != NULL);
-       calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "TODO");
+       calls->sign_justice_transaction_meth = (*env)->GetMethodID(env, c, "sign_justice_transaction", "(JJJ[BJ)J");
        assert(calls->sign_justice_transaction_meth != NULL);
-       calls->sign_remote_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_remote_htlc_transaction", "TODO");
+       calls->sign_remote_htlc_transaction_meth = (*env)->GetMethodID(env, c, "sign_remote_htlc_transaction", "(JJJJJ)J");
        assert(calls->sign_remote_htlc_transaction_meth != NULL);
-       calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "TODO");
+       calls->sign_closing_transaction_meth = (*env)->GetMethodID(env, c, "sign_closing_transaction", "(J)J");
        assert(calls->sign_closing_transaction_meth != NULL);
-       calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "TODO");
+       calls->sign_channel_announcement_meth = (*env)->GetMethodID(env, c, "sign_channel_announcement", "(J)J");
        assert(calls->sign_channel_announcement_meth != NULL);
-       calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "TODO");
+       calls->on_accept_meth = (*env)->GetMethodID(env, c, "on_accept", "(JSS)V");
        assert(calls->on_accept_meth != NULL);
 
        LDKChannelKeys *ret = malloc(sizeof(LDKChannelKeys));
@@ -479,15 +488,15 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKKeysInterface_1new (JNIEnv
        LDKKeysInterface_JCalls *calls = malloc(sizeof(LDKKeysInterface_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "TODO");
+       calls->get_node_secret_meth = (*env)->GetMethodID(env, c, "get_node_secret", "()J");
        assert(calls->get_node_secret_meth != NULL);
-       calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "TODO");
+       calls->get_destination_script_meth = (*env)->GetMethodID(env, c, "get_destination_script", "()J");
        assert(calls->get_destination_script_meth != NULL);
-       calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "TODO");
+       calls->get_shutdown_pubkey_meth = (*env)->GetMethodID(env, c, "get_shutdown_pubkey", "()J");
        assert(calls->get_shutdown_pubkey_meth != NULL);
-       calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "TODO");
+       calls->get_channel_keys_meth = (*env)->GetMethodID(env, c, "get_channel_keys", "(ZJ)J");
        assert(calls->get_channel_keys_meth != NULL);
-       calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "TODO");
+       calls->get_secure_random_bytes_meth = (*env)->GetMethodID(env, c, "get_secure_random_bytes", "()J");
        assert(calls->get_secure_random_bytes_meth != NULL);
 
        LDKKeysInterface *ret = malloc(sizeof(LDKKeysInterface));
@@ -540,11 +549,11 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKManyChannelMonitor_1new (JN
        LDKManyChannelMonitor_JCalls *calls = malloc(sizeof(LDKManyChannelMonitor_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->add_monitor_meth = (*env)->GetMethodID(env, c, "add_monitor", "TODO");
+       calls->add_monitor_meth = (*env)->GetMethodID(env, c, "add_monitor", "(JJ)J");
        assert(calls->add_monitor_meth != NULL);
-       calls->update_monitor_meth = (*env)->GetMethodID(env, c, "update_monitor", "TODO");
+       calls->update_monitor_meth = (*env)->GetMethodID(env, c, "update_monitor", "(JJ)J");
        assert(calls->update_monitor_meth != NULL);
-       calls->get_and_clear_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_monitor_events", "TODO");
+       calls->get_and_clear_pending_monitor_events_meth = (*env)->GetMethodID(env, c, "get_and_clear_pending_monitor_events", "()J");
        assert(calls->get_and_clear_pending_monitor_events_meth != NULL);
 
        LDKManyChannelMonitor *ret = malloc(sizeof(LDKManyChannelMonitor));
@@ -666,43 +675,43 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKChannelMessageHandler_1new
        LDKChannelMessageHandler_JCalls *calls = malloc(sizeof(LDKChannelMessageHandler_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "TODO");
+       calls->handle_open_channel_meth = (*env)->GetMethodID(env, c, "handle_open_channel", "(JJJ)V");
        assert(calls->handle_open_channel_meth != NULL);
-       calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "TODO");
+       calls->handle_accept_channel_meth = (*env)->GetMethodID(env, c, "handle_accept_channel", "(JJJ)V");
        assert(calls->handle_accept_channel_meth != NULL);
-       calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "TODO");
+       calls->handle_funding_created_meth = (*env)->GetMethodID(env, c, "handle_funding_created", "(JJ)V");
        assert(calls->handle_funding_created_meth != NULL);
-       calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "TODO");
+       calls->handle_funding_signed_meth = (*env)->GetMethodID(env, c, "handle_funding_signed", "(JJ)V");
        assert(calls->handle_funding_signed_meth != NULL);
-       calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "TODO");
+       calls->handle_funding_locked_meth = (*env)->GetMethodID(env, c, "handle_funding_locked", "(JJ)V");
        assert(calls->handle_funding_locked_meth != NULL);
-       calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "TODO");
+       calls->handle_shutdown_meth = (*env)->GetMethodID(env, c, "handle_shutdown", "(JJ)V");
        assert(calls->handle_shutdown_meth != NULL);
-       calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "TODO");
+       calls->handle_closing_signed_meth = (*env)->GetMethodID(env, c, "handle_closing_signed", "(JJ)V");
        assert(calls->handle_closing_signed_meth != NULL);
-       calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "TODO");
+       calls->handle_update_add_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_add_htlc", "(JJ)V");
        assert(calls->handle_update_add_htlc_meth != NULL);
-       calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "TODO");
+       calls->handle_update_fulfill_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fulfill_htlc", "(JJ)V");
        assert(calls->handle_update_fulfill_htlc_meth != NULL);
-       calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "TODO");
+       calls->handle_update_fail_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_htlc", "(JJ)V");
        assert(calls->handle_update_fail_htlc_meth != NULL);
-       calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "TODO");
+       calls->handle_update_fail_malformed_htlc_meth = (*env)->GetMethodID(env, c, "handle_update_fail_malformed_htlc", "(JJ)V");
        assert(calls->handle_update_fail_malformed_htlc_meth != NULL);
-       calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "TODO");
+       calls->handle_commitment_signed_meth = (*env)->GetMethodID(env, c, "handle_commitment_signed", "(JJ)V");
        assert(calls->handle_commitment_signed_meth != NULL);
-       calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "TODO");
+       calls->handle_revoke_and_ack_meth = (*env)->GetMethodID(env, c, "handle_revoke_and_ack", "(JJ)V");
        assert(calls->handle_revoke_and_ack_meth != NULL);
-       calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "TODO");
+       calls->handle_update_fee_meth = (*env)->GetMethodID(env, c, "handle_update_fee", "(JJ)V");
        assert(calls->handle_update_fee_meth != NULL);
-       calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "TODO");
+       calls->handle_announcement_signatures_meth = (*env)->GetMethodID(env, c, "handle_announcement_signatures", "(JJ)V");
        assert(calls->handle_announcement_signatures_meth != NULL);
-       calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "TODO");
+       calls->peer_disconnected_meth = (*env)->GetMethodID(env, c, "peer_disconnected", "(JZ)V");
        assert(calls->peer_disconnected_meth != NULL);
-       calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "TODO");
+       calls->peer_connected_meth = (*env)->GetMethodID(env, c, "peer_connected", "(JJ)V");
        assert(calls->peer_connected_meth != NULL);
-       calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "TODO");
+       calls->handle_channel_reestablish_meth = (*env)->GetMethodID(env, c, "handle_channel_reestablish", "(JJ)V");
        assert(calls->handle_channel_reestablish_meth != NULL);
-       calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "TODO");
+       calls->handle_error_meth = (*env)->GetMethodID(env, c, "handle_error", "(JJ)V");
        assert(calls->handle_error_meth != NULL);
 
        LDKChannelMessageHandler *ret = malloc(sizeof(LDKChannelMessageHandler));
@@ -795,19 +804,19 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKRoutingMessageHandler_1new
        LDKRoutingMessageHandler_JCalls *calls = malloc(sizeof(LDKRoutingMessageHandler_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "TODO");
+       calls->handle_node_announcement_meth = (*env)->GetMethodID(env, c, "handle_node_announcement", "(J)J");
        assert(calls->handle_node_announcement_meth != NULL);
-       calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "TODO");
+       calls->handle_channel_announcement_meth = (*env)->GetMethodID(env, c, "handle_channel_announcement", "(J)J");
        assert(calls->handle_channel_announcement_meth != NULL);
-       calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "TODO");
+       calls->handle_channel_update_meth = (*env)->GetMethodID(env, c, "handle_channel_update", "(J)J");
        assert(calls->handle_channel_update_meth != NULL);
-       calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "TODO");
+       calls->handle_htlc_fail_channel_update_meth = (*env)->GetMethodID(env, c, "handle_htlc_fail_channel_update", "(J)V");
        assert(calls->handle_htlc_fail_channel_update_meth != NULL);
-       calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "TODO");
+       calls->get_next_channel_announcements_meth = (*env)->GetMethodID(env, c, "get_next_channel_announcements", "(JB)J");
        assert(calls->get_next_channel_announcements_meth != NULL);
-       calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "TODO");
+       calls->get_next_node_announcements_meth = (*env)->GetMethodID(env, c, "get_next_node_announcements", "(JB)J");
        assert(calls->get_next_node_announcements_meth != NULL);
-       calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "TODO");
+       calls->should_request_full_sync_meth = (*env)->GetMethodID(env, c, "should_request_full_sync", "(J)Z");
        assert(calls->should_request_full_sync_meth != NULL);
 
        LDKRoutingMessageHandler *ret = malloc(sizeof(LDKRoutingMessageHandler));
@@ -866,13 +875,13 @@ JNIEXPORT long JNICALL Java_org_ldk_impl_bindings_LDKSocketDescriptor_1new (JNIE
        LDKSocketDescriptor_JCalls *calls = malloc(sizeof(LDKSocketDescriptor_JCalls));
        calls->env = env;
        calls->o = (*env)->NewGlobalRef(env, o);
-       calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "TODO");
+       calls->send_data_meth = (*env)->GetMethodID(env, c, "send_data", "(JZ)J");
        assert(calls->send_data_meth != NULL);
-       calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "TODO");
+       calls->disconnect_socket_meth = (*env)->GetMethodID(env, c, "disconnect_socket", "()V");
        assert(calls->disconnect_socket_meth != NULL);
-       calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "TODO");
+       calls->eq_meth = (*env)->GetMethodID(env, c, "eq", "(V)Z");
        assert(calls->eq_meth != NULL);
-       calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "TODO");
+       calls->hash_meth = (*env)->GetMethodID(env, c, "hash", "()J");
        assert(calls->hash_meth != NULL);
 
        LDKSocketDescriptor *ret = malloc(sizeof(LDKSocketDescriptor));
@@ -1494,18 +1503,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1m
        return ChannelHandshakeConfig_set_minimum_depth(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = ChannelHandshakeConfig_get_our_to_self_delay(this_ptr_conv);
-       return (long)ret;
+       return ChannelHandshakeConfig_get_our_to_self_delay(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1our_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKChannelHandshakeConfig* this_ptr_conv = (LDKChannelHandshakeConfig*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return ChannelHandshakeConfig_set_our_to_self_delay(this_ptr_conv, val_conv);
+       return ChannelHandshakeConfig_set_our_to_self_delay(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1get_1our_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -1518,11 +1523,9 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1set_1o
        return ChannelHandshakeConfig_set_our_htlc_minimum_msat(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeConfig_1new(JNIEnv * _env, jclass _b, jint minimum_depth_arg, jlong our_to_self_delay_arg, jlong our_htlc_minimum_msat_arg) {
-       uint16_t our_to_self_delay_arg_conv = *(uint16_t*)our_to_self_delay_arg;
-       free((void*)our_to_self_delay_arg);
+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) {
        LDKChannelHandshakeConfig* ret = malloc(sizeof(LDKChannelHandshakeConfig));
-       *ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg_conv, our_htlc_minimum_msat_arg);
+       *ret = ChannelHandshakeConfig_new(minimum_depth_arg, our_to_self_delay_arg, our_htlc_minimum_msat_arg);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -1583,18 +1586,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1m
        return ChannelHandshakeLimits_set_max_channel_reserve_satoshis(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr_conv);
-       return (long)ret;
+       return ChannelHandshakeLimits_get_min_max_accepted_htlcs(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1min_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr_conv, val_conv);
+       return ChannelHandshakeLimits_set_min_max_accepted_htlcs(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1min_1dust_1limit_1satoshis(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -1637,27 +1636,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1f
        return ChannelHandshakeLimits_set_force_announced_channel_preference(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1get_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = ChannelHandshakeLimits_get_their_to_self_delay(this_ptr_conv);
-       return (long)ret;
+       return ChannelHandshakeLimits_get_their_to_self_delay(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelHandshakeLimits_1set_1their_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKChannelHandshakeLimits* this_ptr_conv = (LDKChannelHandshakeLimits*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return ChannelHandshakeLimits_set_their_to_self_delay(this_ptr_conv, val_conv);
+       return ChannelHandshakeLimits_set_their_to_self_delay(this_ptr_conv, val);
 }
 
-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, jlong min_max_accepted_htlcs_arg, jlong min_dust_limit_satoshis_arg, jlong max_dust_limit_satoshis_arg, jint max_minimum_depth_arg, jboolean force_announced_channel_preference_arg, jlong their_to_self_delay_arg) {
-       uint16_t min_max_accepted_htlcs_arg_conv = *(uint16_t*)min_max_accepted_htlcs_arg;
-       free((void*)min_max_accepted_htlcs_arg);
-       uint16_t their_to_self_delay_arg_conv = *(uint16_t*)their_to_self_delay_arg;
-       free((void*)their_to_self_delay_arg);
+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) {
        LDKChannelHandshakeLimits* ret = malloc(sizeof(LDKChannelHandshakeLimits));
-       *ret = ChannelHandshakeLimits_new(min_funding_satoshis_arg, max_htlc_minimum_msat_arg, min_max_htlc_value_in_flight_msat_arg, max_channel_reserve_satoshis_arg, min_max_accepted_htlcs_arg_conv, min_dust_limit_satoshis_arg, max_dust_limit_satoshis_arg, max_minimum_depth_arg, force_announced_channel_preference_arg, their_to_self_delay_arg_conv);
+       *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);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -1997,27 +1988,21 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1txid(JNIEnv * _
        return OutPoint_set_txid(this_ptr_conv, val_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OutPoint_1get_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = OutPoint_get_index(this_ptr_conv);
-       return (long)ret;
+       return OutPoint_get_index(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OutPoint_1set_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKOutPoint* this_ptr_conv = (LDKOutPoint*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return OutPoint_set_index(this_ptr_conv, val_conv);
+       return OutPoint_set_index(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jlong txid_arg, jlong index_arg) {
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OutPoint_1new(JNIEnv * _env, jclass _b, jlong txid_arg, jshort index_arg) {
        LDKThirtyTwoBytes txid_arg_conv = *(LDKThirtyTwoBytes*)txid_arg;
        free((void*)txid_arg);
-       uint16_t index_arg_conv = *(uint16_t*)index_arg;
-       free((void*)index_arg);
        LDKOutPoint* ret = malloc(sizeof(LDKOutPoint));
-       *ret = OutPoint_new(txid_arg_conv, index_arg_conv);
+       *ret = OutPoint_new(txid_arg_conv, index_arg);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -2187,18 +2172,14 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1remote_1
        return (long)ret;
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1remote_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1remote_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
        LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = InMemoryChannelKeys_remote_to_self_delay(this_arg_conv);
-       return (long)ret;
+       return InMemoryChannelKeys_remote_to_self_delay(this_arg_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1local_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1local_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_arg) {
        LDKInMemoryChannelKeys* this_arg_conv = (LDKInMemoryChannelKeys*)this_arg;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = InMemoryChannelKeys_local_to_self_delay(this_arg_conv);
-       return (long)ret;
+       return InMemoryChannelKeys_local_to_self_delay(this_arg_conv);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_InMemoryChannelKeys_1as_1ChannelKeys(JNIEnv * _env, jclass _b, jlong this_arg) {
@@ -2564,7 +2545,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1free(J
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
-       return (long) ChannelManagerReadArgs_get_keys_manager(this_ptr_conv);
+       long ret = (long)ChannelManagerReadArgs_get_keys_manager(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1keys_1manager(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -2576,7 +2558,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1k
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
-       return (long) ChannelManagerReadArgs_get_fee_estimator(this_ptr_conv);
+       long ret = (long)ChannelManagerReadArgs_get_fee_estimator(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1fee_1estimator(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -2588,7 +2571,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1f
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
-       return (long) ChannelManagerReadArgs_get_monitor(this_ptr_conv);
+       long ret = (long)ChannelManagerReadArgs_get_monitor(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1monitor(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -2600,7 +2584,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1m
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
-       return (long) ChannelManagerReadArgs_get_tx_broadcaster(this_ptr_conv);
+       long ret = (long)ChannelManagerReadArgs_get_tx_broadcaster(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1tx_1broadcaster(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -2612,7 +2597,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1t
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1get_1logger(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKChannelManagerReadArgs* this_ptr_conv = (LDKChannelManagerReadArgs*)this_ptr;
-       return (long) ChannelManagerReadArgs_get_logger(this_ptr_conv);
+       long ret = (long)ChannelManagerReadArgs_get_logger(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_ChannelManagerReadArgs_1set_1logger(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -2861,41 +2847,29 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1free(JNIEnv * _env, jcla
        return Ping_free(this_ptr_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = Ping_get_ponglen(this_ptr_conv);
-       return (long)ret;
+       return Ping_get_ponglen(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1ponglen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return Ping_set_ponglen(this_ptr_conv, val_conv);
+       return Ping_set_ponglen(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Ping_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = Ping_get_byteslen(this_ptr_conv);
-       return (long)ret;
+       return Ping_get_byteslen(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Ping_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKPing* this_ptr_conv = (LDKPing*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return Ping_set_byteslen(this_ptr_conv, val_conv);
+       return Ping_set_byteslen(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jlong ponglen_arg, jlong byteslen_arg) {
-       uint16_t ponglen_arg_conv = *(uint16_t*)ponglen_arg;
-       free((void*)ponglen_arg);
-       uint16_t byteslen_arg_conv = *(uint16_t*)byteslen_arg;
-       free((void*)byteslen_arg);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Ping_1new(JNIEnv * _env, jclass _b, jshort ponglen_arg, jshort byteslen_arg) {
        LDKPing* ret = malloc(sizeof(LDKPing));
-       *ret = Ping_new(ponglen_arg_conv, byteslen_arg_conv);
+       *ret = Ping_new(ponglen_arg, byteslen_arg);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -2908,25 +2882,19 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1free(JNIEnv * _env, jcla
        return Pong_free(this_ptr_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_Pong_1get_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = Pong_get_byteslen(this_ptr_conv);
-       return (long)ret;
+       return Pong_get_byteslen(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_Pong_1set_1byteslen(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKPong* this_ptr_conv = (LDKPong*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return Pong_set_byteslen(this_ptr_conv, val_conv);
+       return Pong_set_byteslen(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jlong byteslen_arg) {
-       uint16_t byteslen_arg_conv = *(uint16_t*)byteslen_arg;
-       free((void*)byteslen_arg);
+JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_Pong_1new(JNIEnv * _env, jclass _b, jshort byteslen_arg) {
        LDKPong* ret = malloc(sizeof(LDKPong));
-       *ret = Pong_new(byteslen_arg_conv);
+       *ret = Pong_new(byteslen_arg);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -3037,32 +3005,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1feerate_1per
        return OpenChannel_set_feerate_per_kw(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = OpenChannel_get_to_self_delay(this_ptr_conv);
-       return (long)ret;
+       return OpenChannel_get_to_self_delay(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return OpenChannel_set_to_self_delay(this_ptr_conv, val_conv);
+       return OpenChannel_set_to_self_delay(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = OpenChannel_get_max_accepted_htlcs(this_ptr_conv);
-       return (long)ret;
+       return OpenChannel_get_max_accepted_htlcs(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_OpenChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKOpenChannel* this_ptr_conv = (LDKOpenChannel*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return OpenChannel_set_max_accepted_htlcs(this_ptr_conv, val_conv);
+       return OpenChannel_set_max_accepted_htlcs(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_OpenChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -3230,32 +3190,24 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1minimum_1d
        return AcceptChannel_set_minimum_depth(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = AcceptChannel_get_to_self_delay(this_ptr_conv);
-       return (long)ret;
+       return AcceptChannel_get_to_self_delay(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1to_1self_1delay(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return AcceptChannel_set_to_self_delay(this_ptr_conv, val_conv);
+       return AcceptChannel_set_to_self_delay(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = AcceptChannel_get_max_accepted_htlcs(this_ptr_conv);
-       return (long)ret;
+       return AcceptChannel_get_max_accepted_htlcs(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1set_1max_1accepted_1htlcs(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKAcceptChannel* this_ptr_conv = (LDKAcceptChannel*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return AcceptChannel_set_max_accepted_htlcs(this_ptr_conv, val_conv);
+       return AcceptChannel_set_max_accepted_htlcs(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_AcceptChannel_1get_1funding_1pubkey(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -3377,18 +3329,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1
        return FundingCreated_set_funding_txid(this_ptr_conv, val_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = FundingCreated_get_funding_output_index(this_ptr_conv);
-       return (long)ret;
+       return FundingCreated_get_funding_output_index(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1funding_1output_1index(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKFundingCreated* this_ptr_conv = (LDKFundingCreated*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return FundingCreated_set_funding_output_index(this_ptr_conv, val_conv);
+       return FundingCreated_set_funding_output_index(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1get_1signature(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -3405,17 +3353,15 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_FundingCreated_1set_1signature
        return FundingCreated_set_signature(this_ptr_conv, val_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_FundingCreated_1new(JNIEnv * _env, jclass _b, jlong temporary_channel_id_arg, jlong funding_txid_arg, jlong funding_output_index_arg, jlong signature_arg) {
+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) {
        LDKThirtyTwoBytes temporary_channel_id_arg_conv = *(LDKThirtyTwoBytes*)temporary_channel_id_arg;
        free((void*)temporary_channel_id_arg);
        LDKThirtyTwoBytes funding_txid_arg_conv = *(LDKThirtyTwoBytes*)funding_txid_arg;
        free((void*)funding_txid_arg);
-       uint16_t funding_output_index_arg_conv = *(uint16_t*)funding_output_index_arg;
-       free((void*)funding_output_index_arg);
        LDKSignature signature_arg_conv = *(LDKSignature*)signature_arg;
        free((void*)signature_arg);
        LDKFundingCreated* ret = malloc(sizeof(LDKFundingCreated));
-       *ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg_conv, signature_arg_conv);
+       *ret = FundingCreated_new(temporary_channel_id_arg_conv, funding_txid_arg_conv, funding_output_index_arg, signature_arg_conv);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -3803,18 +3749,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1
        return UpdateFailMalformedHTLC_set_htlc_id(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1get_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = UpdateFailMalformedHTLC_get_failure_code(this_ptr_conv);
-       return (long)ret;
+       return UpdateFailMalformedHTLC_get_failure_code(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UpdateFailMalformedHTLC_1set_1failure_1code(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKUpdateFailMalformedHTLC* this_ptr_conv = (LDKUpdateFailMalformedHTLC*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return UpdateFailMalformedHTLC_set_failure_code(this_ptr_conv, val_conv);
+       return UpdateFailMalformedHTLC_set_failure_code(this_ptr_conv, val);
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_CommitmentSigned_1free(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -4498,18 +4440,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1fl
        return UnsignedChannelUpdate_set_flags(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr_conv);
-       return (long)ret;
+       return UnsignedChannelUpdate_get_cltv_expiry_delta(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKUnsignedChannelUpdate* this_ptr_conv = (LDKUnsignedChannelUpdate*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr_conv, val_conv);
+       return UnsignedChannelUpdate_set_cltv_expiry_delta(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_UnsignedChannelUpdate_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -5206,7 +5144,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1free(JNIEnv *
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
-       return (long) MessageHandler_get_chan_handler(this_ptr_conv);
+       long ret = (long)MessageHandler_get_chan_handler(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -5218,7 +5157,8 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1chan_1han
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_MessageHandler_1get_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKMessageHandler* this_ptr_conv = (LDKMessageHandler*)this_ptr;
-       return (long) MessageHandler_get_route_handler(this_ptr_conv);
+       long ret = (long)MessageHandler_get_route_handler(this_ptr_conv);
+       return ret;
 }
 
 JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_MessageHandler_1set_1route_1handler(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
@@ -5640,15 +5580,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_TxCreationKeys_1derive_1new(J
        return (long)ret;
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_get_1revokeable_1redeemscript(JNIEnv * _env, jclass _b, jlong revocation_key, jlong to_self_delay, jlong delayed_payment_key) {
+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) {
        LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
        free((void*)revocation_key);
-       uint16_t to_self_delay_conv = *(uint16_t*)to_self_delay;
-       free((void*)to_self_delay);
        LDKPublicKey delayed_payment_key_conv = *(LDKPublicKey*)delayed_payment_key;
        free((void*)delayed_payment_key);
        LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
-       *ret = get_revokeable_redeemscript(revocation_key_conv, to_self_delay_conv, delayed_payment_key_conv);
+       *ret = get_revokeable_redeemscript(revocation_key_conv, to_self_delay, delayed_payment_key_conv);
        return (long)ret;
 }
 
@@ -5738,19 +5676,17 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_make_1funding_1redeemscript(J
        return (long)ret;
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_build_1htlc_1transaction(JNIEnv * _env, jclass _b, jbyteArray prev_hash, jint feerate_per_kw, jlong to_self_delay, jlong htlc, jlong a_delayed_payment_key, jlong revocation_key) {
+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) {
        unsigned char prev_hash_arr[32];
        (*_env)->GetByteArrayRegion (_env, prev_hash, 0, 32, prev_hash_arr);
        unsigned char (*prev_hash_ref)[32] = &prev_hash_arr;
-       uint16_t to_self_delay_conv = *(uint16_t*)to_self_delay;
-       free((void*)to_self_delay);
        LDKHTLCOutputInCommitment* htlc_conv = (LDKHTLCOutputInCommitment*)htlc;
        LDKPublicKey a_delayed_payment_key_conv = *(LDKPublicKey*)a_delayed_payment_key;
        free((void*)a_delayed_payment_key);
        LDKPublicKey revocation_key_conv = *(LDKPublicKey*)revocation_key;
        free((void*)revocation_key);
        LDKCVec_u8Z* ret = malloc(sizeof(LDKCVec_u8Z));
-       *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, to_self_delay_conv, htlc_conv, a_delayed_payment_key_conv, revocation_key_conv);
+       *ret = build_htlc_transaction(prev_hash_ref, feerate_per_kw, to_self_delay, htlc_conv, a_delayed_payment_key_conv, revocation_key_conv);
        return (long)ret;
 }
 
@@ -5855,15 +5791,13 @@ JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1g
        return (long)ret;
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_LocalCommitmentTransaction_1get_1htlc_1sigs(JNIEnv * _env, jclass _b, jlong this_arg, jbyteArray htlc_base_key, jlong local_csv) {
+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) {
        LDKLocalCommitmentTransaction* this_arg_conv = (LDKLocalCommitmentTransaction*)this_arg;
        unsigned char htlc_base_key_arr[32];
        (*_env)->GetByteArrayRegion (_env, htlc_base_key, 0, 32, htlc_base_key_arr);
        unsigned char (*htlc_base_key_ref)[32] = &htlc_base_key_arr;
-       uint16_t local_csv_conv = *(uint16_t*)local_csv;
-       free((void*)local_csv);
        LDKCResult_CVec_SignatureZNoneZ* ret = malloc(sizeof(LDKCResult_CVec_SignatureZNoneZ));
-       *ret = LocalCommitmentTransaction_get_htlc_sigs(this_arg_conv, htlc_base_key_ref, local_csv_conv);
+       *ret = LocalCommitmentTransaction_get_htlc_sigs(this_arg_conv, htlc_base_key_ref, local_csv);
        return (long)ret;
 }
 
@@ -6045,18 +5979,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1fees(JNIEnv *
        return RouteHint_set_fees(this_ptr_conv, val_conv);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = RouteHint_get_cltv_expiry_delta(this_ptr_conv);
-       return (long)ret;
+       return RouteHint_get_cltv_expiry_delta(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKRouteHint* this_ptr_conv = (LDKRouteHint*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return RouteHint_set_cltv_expiry_delta(this_ptr_conv, val_conv);
+       return RouteHint_set_cltv_expiry_delta(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_RouteHint_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {
@@ -6069,16 +5999,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_RouteHint_1set_1htlc_1minimum_
        return RouteHint_set_htlc_minimum_msat(this_ptr_conv, val);
 }
 
-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, jlong cltv_expiry_delta_arg, jlong htlc_minimum_msat_arg) {
+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) {
        LDKPublicKey src_node_id_arg_conv = *(LDKPublicKey*)src_node_id_arg;
        free((void*)src_node_id_arg);
        LDKRoutingFees fees_arg_conv = *(LDKRoutingFees*)fees_arg;
        free((void*)fees_arg);
        fees_arg_conv._underlying_ref = false;
-       uint16_t cltv_expiry_delta_arg_conv = *(uint16_t*)cltv_expiry_delta_arg;
-       free((void*)cltv_expiry_delta_arg);
        LDKRouteHint* ret = malloc(sizeof(LDKRouteHint));
-       *ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg_conv, htlc_minimum_msat_arg);
+       *ret = RouteHint_new(src_node_id_arg_conv, short_channel_id_arg, fees_arg_conv, cltv_expiry_delta_arg, htlc_minimum_msat_arg);
        assert(!ret->_underlying_ref);
        ret->_underlying_ref = true;
        return (long)ret;
@@ -6200,18 +6128,14 @@ JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1e
        return DirectionalChannelInfo_set_enabled(this_ptr_conv, val);
 }
 
-JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
+JNIEXPORT jshort JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr) {
        LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
-       uint16_t* ret = malloc(sizeof(uint16_t));
-       *ret = DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr_conv);
-       return (long)ret;
+       return DirectionalChannelInfo_get_cltv_expiry_delta(this_ptr_conv);
 }
 
-JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jlong val) {
+JNIEXPORT void JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1set_1cltv_1expiry_1delta(JNIEnv * _env, jclass _b, jlong this_ptr, jshort val) {
        LDKDirectionalChannelInfo* this_ptr_conv = (LDKDirectionalChannelInfo*)this_ptr;
-       uint16_t val_conv = *(uint16_t*)val;
-       free((void*)val);
-       return DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr_conv, val_conv);
+       return DirectionalChannelInfo_set_cltv_expiry_delta(this_ptr_conv, val);
 }
 
 JNIEXPORT jlong JNICALL Java_org_ldk_impl_bindings_DirectionalChannelInfo_1get_1htlc_1minimum_1msat(JNIEnv * _env, jclass _b, jlong this_ptr) {