[C#] Update auto-generated C# bindings
[ldk-java] / c_sharp / src / org / ldk / structs / UtilMethods.cs
index 4f333b8f0d1c8e704b01882f4d8a20c5a5a3e8ab..6e47ecc6f60b1dd39e210f3e68fae4007c665102 100644 (file)
@@ -10,17 +10,20 @@ public class UtilMethods {
         * Gets the 128-bit integer, as 16 little-endian bytes
         */
        public static byte[] U128_le_bytes(org.ldk.util.UInt128 val) {
-               byte[] ret = bindings.U128_le_bytes(val.getLEBytes());
+               long ret = bindings.U128_le_bytes(InternalUtils.encodeUint8Array(val.getLEBytes()));
                GC.KeepAlive(val);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Constructs a new U128 from 16 little-endian bytes
         */
        public static UInt128 U128_new(byte[] le_bytes) {
-               byte[] ret = bindings.U128_new(InternalUtils.check_arr_len(le_bytes, 16));
+               long ret = bindings.U128_new(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(le_bytes, 16)));
                GC.KeepAlive(le_bytes);
+               if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
                return ret_conv;
        }
@@ -45,7 +48,7 @@ public class UtilMethods {
         * Read a APIError from a byte array, created by APIError_write
         */
        public static Result_COption_APIErrorZDecodeErrorZ APIError_read(byte[] ser) {
-               long ret = bindings.APIError_read(ser);
+               long ret = bindings.APIError_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret);
@@ -57,24 +60,24 @@ public class UtilMethods {
         * A receiver knowing the PublicKey (e.g. the node's id) and the message can be sure that the signature was generated by the caller.
         * Signatures are EC recoverable, meaning that given the message and the signature the PublicKey of the signer can be extracted.
         */
-       public static Result_StringErrorZ sign(byte[] msg, byte[] sk) {
-               long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32));
+       public static Result_StrSecp256k1ErrorZ sign(byte[] msg, byte[] sk) {
+               long ret = bindings.sign(InternalUtils.encodeUint8Array(msg), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(sk, 32)));
                GC.KeepAlive(msg);
                GC.KeepAlive(sk);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_StringErrorZ ret_hu_conv = Result_StringErrorZ.constr_from_ptr(ret);
+               Result_StrSecp256k1ErrorZ ret_hu_conv = Result_StrSecp256k1ErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
        /**
         * Recovers the PublicKey of the signer of the message given the message and the signature.
         */
-       public static Result_PublicKeyErrorZ recover_pk(byte[] msg, string sig) {
-               long ret = bindings.recover_pk(msg, sig);
+       public static Result_PublicKeySecp256k1ErrorZ recover_pk(byte[] msg, string sig) {
+               long ret = bindings.recover_pk(InternalUtils.encodeUint8Array(msg), InternalUtils.encodeString(sig));
                GC.KeepAlive(msg);
                GC.KeepAlive(sig);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret);
+               Result_PublicKeySecp256k1ErrorZ ret_hu_conv = Result_PublicKeySecp256k1ErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
@@ -83,7 +86,7 @@ public class UtilMethods {
         * and the PublicKey.
         */
        public static bool verify(byte[] msg, string sig, byte[] pk) {
-               bool ret = bindings.verify(msg, sig, InternalUtils.check_arr_len(pk, 33));
+               bool ret = bindings.verify(InternalUtils.encodeUint8Array(msg), InternalUtils.encodeString(sig), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(pk, 33)));
                GC.KeepAlive(msg);
                GC.KeepAlive(sig);
                GC.KeepAlive(pk);
@@ -94,17 +97,35 @@ public class UtilMethods {
         * Construct the invoice's HRP and signatureless data into a preimage to be hashed.
         */
        public static byte[] construct_invoice_preimage(byte[] hrp_bytes, UInt5[] data_without_signature) {
-               byte[] ret = bindings.construct_invoice_preimage(hrp_bytes, data_without_signature != null ? InternalUtils.convUInt5Array(data_without_signature) : null);
+               long ret = bindings.construct_invoice_preimage(InternalUtils.encodeUint8Array(hrp_bytes), InternalUtils.encodeUint8Array(InternalUtils.convUInt5Array(data_without_signature)));
                GC.KeepAlive(hrp_bytes);
                GC.KeepAlive(data_without_signature);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
+       }
+
+       /**
+        * Read previously persisted [`ChannelMonitor`]s from the store.
+        */
+       public static Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ read_channel_monitors(org.ldk.structs.KVStore kv_store, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.SignerProvider signer_provider) {
+               long ret = bindings.read_channel_monitors(kv_store.ptr, entropy_source.ptr, signer_provider.ptr);
+               GC.KeepAlive(kv_store);
+               GC.KeepAlive(entropy_source);
+               GC.KeepAlive(signer_provider);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesChannelMonitorZZIOErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(kv_store); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(signer_provider); };
+               return ret_hu_conv;
        }
 
        /**
         * Read a MonitorEvent from a byte array, created by MonitorEvent_write
         */
        public static Result_COption_MonitorEventZDecodeErrorZ MonitorEvent_read(byte[] ser) {
-               long ret = bindings.MonitorEvent_read(ser);
+               long ret = bindings.MonitorEvent_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_MonitorEventZDecodeErrorZ ret_hu_conv = Result_COption_MonitorEventZDecodeErrorZ.constr_from_ptr(ret);
@@ -112,22 +133,22 @@ public class UtilMethods {
        }
 
        /**
-        * Read a C2Tuple_BlockHashChannelMonitorZ from a byte array, created by C2Tuple_BlockHashChannelMonitorZ_write
+        * Read a C2Tuple_ThirtyTwoBytesChannelMonitorZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelMonitorZ_write
         */
-       public static Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ C2Tuple_BlockHashChannelMonitorZ_read(byte[] ser, org.ldk.structs.EntropySource arg_a, org.ldk.structs.SignerProvider arg_b) {
-               long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg_a.ptr, arg_b.ptr);
+       public static Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(byte[] ser, org.ldk.structs.EntropySource arg_a, org.ldk.structs.SignerProvider arg_b) {
+               long ret = bindings.C2Tuple_ThirtyTwoBytesChannelMonitorZ_read(InternalUtils.encodeUint8Array(ser), arg_a.ptr, arg_b.ptr);
                GC.KeepAlive(ser);
                GC.KeepAlive(arg_a);
                GC.KeepAlive(arg_b);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
+               Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(arg_a); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(arg_b); };
                return ret_hu_conv;
        }
 
        /**
-        * Fetches the set of [`InitFeatures`] flags which are provided by or required by
+        * Fetches the set of [`InitFeatures`] flags that are provided by or required by
         * [`ChannelManager`].
         */
        public static InitFeatures provided_init_features(org.ldk.structs.UserConfig config) {
@@ -141,10 +162,10 @@ public class UtilMethods {
        }
 
        /**
-        * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_write
+        * Read a C2Tuple_ThirtyTwoBytesChannelManagerZ from a byte array, created by C2Tuple_ThirtyTwoBytesChannelManagerZ_write
         */
-       public static Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ C2Tuple_BlockHashChannelManagerZ_read(byte[] ser, EntropySource arg_entropy_source, NodeSigner arg_node_signer, SignerProvider arg_signer_provider, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Router arg_router, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
-               long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_entropy_source.ptr, arg_node_signer.ptr, arg_signer_provider.ptr, arg_fee_estimator.ptr, arg_chain_monitor.ptr, arg_tx_broadcaster.ptr, arg_router.ptr, arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, arg_channel_monitors != null ? InternalUtils.mapArray(arg_channel_monitors, arg_channel_monitors_conv_16 => arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr) : null));
+       public static Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ C2Tuple_ThirtyTwoBytesChannelManagerZ_read(byte[] ser, EntropySource arg_entropy_source, NodeSigner arg_node_signer, SignerProvider arg_signer_provider, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Router arg_router, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
+               long ret = bindings.C2Tuple_ThirtyTwoBytesChannelManagerZ_read(InternalUtils.encodeUint8Array(ser), bindings.ChannelManagerReadArgs_new(arg_entropy_source.ptr, arg_node_signer.ptr, arg_signer_provider.ptr, arg_fee_estimator.ptr, arg_chain_monitor.ptr, arg_tx_broadcaster.ptr, arg_router.ptr, arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(arg_channel_monitors, arg_channel_monitors_conv_16 => arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr))));
                GC.KeepAlive(ser);
                GC.KeepAlive(arg_entropy_source);
                GC.KeepAlive(arg_node_signer);
@@ -157,7 +178,7 @@ public class UtilMethods {
                GC.KeepAlive(arg_default_config);
                GC.KeepAlive(arg_channel_monitors);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
+               Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(arg_entropy_source); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(arg_node_signer); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(arg_signer_provider); };
@@ -188,7 +209,7 @@ public class UtilMethods {
         * [phantom node payments]: crate::sign::PhantomKeysManager
         * [`NodeSigner::get_inbound_payment_key_material`]: crate::sign::NodeSigner::get_inbound_payment_key_material
         */
-       public static Result_C2Tuple_PaymentHashPaymentSecretZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.EntropySource entropy_source, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
+       public static Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ create(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, int invoice_expiry_delta_secs, org.ldk.structs.EntropySource entropy_source, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
                long ret = bindings.create(keys == null ? 0 : keys.ptr, min_value_msat.ptr, invoice_expiry_delta_secs, entropy_source.ptr, current_time, min_final_cltv_expiry_delta.ptr);
                GC.KeepAlive(keys);
                GC.KeepAlive(min_value_msat);
@@ -197,7 +218,7 @@ public class UtilMethods {
                GC.KeepAlive(current_time);
                GC.KeepAlive(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.constr_from_ptr(ret);
+               Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(keys); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(min_value_msat); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
@@ -217,8 +238,8 @@ public class UtilMethods {
         * 
         * [phantom node payments]: crate::sign::PhantomKeysManager
         */
-       public static Result_PaymentSecretNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
-               long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta.ptr);
+       public static Result_ThirtyTwoBytesNoneZ create_from_hash(org.ldk.structs.ExpandedKey keys, org.ldk.structs.Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
+               long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr, min_value_msat.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta.ptr);
                GC.KeepAlive(keys);
                GC.KeepAlive(min_value_msat);
                GC.KeepAlive(payment_hash);
@@ -226,13 +247,27 @@ public class UtilMethods {
                GC.KeepAlive(current_time);
                GC.KeepAlive(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
+               Result_ThirtyTwoBytesNoneZ ret_hu_conv = Result_ThirtyTwoBytesNoneZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(keys); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(min_value_msat); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
+       /**
+        * Parses an OnionV3 host and port into a [`SocketAddress::OnionV3`].
+        * 
+        * The host part must end with \".onion\".
+        */
+       public static Result_SocketAddressSocketAddressParseErrorZ parse_onion_address(string host, short port) {
+               long ret = bindings.parse_onion_address(InternalUtils.encodeString(host), port);
+               GC.KeepAlive(host);
+               GC.KeepAlive(port);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_SocketAddressSocketAddressParseErrorZ ret_hu_conv = Result_SocketAddressSocketAddressParseErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
        /**
         * Gets the weight for an HTLC-Success transaction.
         */
@@ -255,7 +290,7 @@ public class UtilMethods {
         * Check if a given input witness attempts to claim a HTLC.
         */
        public static Option_HTLCClaimZ HTLCClaim_from_witness(byte[] witness) {
-               long ret = bindings.HTLCClaim_from_witness(witness);
+               long ret = bindings.HTLCClaim_from_witness(InternalUtils.encodeUint8Array(witness));
                GC.KeepAlive(witness);
                if (ret >= 0 && ret <= 4096) { return null; }
                org.ldk.structs.Option_HTLCClaimZ ret_hu_conv = org.ldk.structs.Option_HTLCClaimZ.constr_from_ptr(ret);
@@ -267,23 +302,27 @@ public class UtilMethods {
         * Build the commitment secret from the seed and the commitment number
         */
        public static byte[] build_commitment_secret(byte[] commitment_seed, long idx) {
-               byte[] ret = bindings.build_commitment_secret(InternalUtils.check_arr_len(commitment_seed, 32), idx);
+               long ret = bindings.build_commitment_secret(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(commitment_seed, 32)), idx);
                GC.KeepAlive(commitment_seed);
                GC.KeepAlive(idx);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Build a closing transaction
         */
        public static byte[] build_closing_transaction(long to_holder_value_sat, long to_counterparty_value_sat, byte[] to_holder_script, byte[] to_counterparty_script, org.ldk.structs.OutPoint funding_outpoint) {
-               byte[] ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, to_holder_script, to_counterparty_script, funding_outpoint == null ? 0 : funding_outpoint.ptr);
+               long ret = bindings.build_closing_transaction(to_holder_value_sat, to_counterparty_value_sat, InternalUtils.encodeUint8Array(to_holder_script), InternalUtils.encodeUint8Array(to_counterparty_script), funding_outpoint == null ? 0 : funding_outpoint.ptr);
                GC.KeepAlive(to_holder_value_sat);
                GC.KeepAlive(to_counterparty_value_sat);
                GC.KeepAlive(to_holder_script);
                GC.KeepAlive(to_counterparty_script);
                GC.KeepAlive(funding_outpoint);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -291,10 +330,12 @@ public class UtilMethods {
         * from the base secret and the per_commitment_point.
         */
        public static byte[] derive_private_key(byte[] per_commitment_point, byte[] base_secret) {
-               byte[] ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32));
+               long ret = bindings.derive_private_key(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(base_secret, 32)));
                GC.KeepAlive(per_commitment_point);
                GC.KeepAlive(base_secret);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -303,10 +344,12 @@ public class UtilMethods {
         * derive_private_key - using only public keys to derive a public key instead of private keys.
         */
        public static byte[] derive_public_key(byte[] per_commitment_point, byte[] base_point) {
-               byte[] ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33));
+               long ret = bindings.derive_public_key(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(base_point, 33)));
                GC.KeepAlive(per_commitment_point);
                GC.KeepAlive(base_point);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -318,10 +361,12 @@ public class UtilMethods {
         * of the transaction spending with this key knowledge.
         */
        public static byte[] derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) {
-               byte[] ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32));
+               long ret = bindings.derive_private_revocation_key(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_secret, 32)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32)));
                GC.KeepAlive(per_commitment_secret);
                GC.KeepAlive(countersignatory_revocation_base_secret);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -338,10 +383,12 @@ public class UtilMethods {
         * generated (ie our own).
         */
        public static byte[] derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) {
-               byte[] ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33));
+               long ret = bindings.derive_public_revocation_key(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(per_commitment_point, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33)));
                GC.KeepAlive(per_commitment_point);
                GC.KeepAlive(countersignatory_revocation_base_point);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -350,11 +397,26 @@ public class UtilMethods {
         * Encumbering a `to_holder` output on a commitment transaction or 2nd-stage HTLC transactions.
         */
        public static byte[] get_revokeable_redeemscript(byte[] revocation_key, short contest_delay, byte[] broadcaster_delayed_payment_key) {
-               byte[] ret = bindings.get_revokeable_redeemscript(InternalUtils.check_arr_len(revocation_key, 33), contest_delay, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33));
+               long ret = bindings.get_revokeable_redeemscript(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_key, 33)), contest_delay, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33)));
                GC.KeepAlive(revocation_key);
                GC.KeepAlive(contest_delay);
                GC.KeepAlive(broadcaster_delayed_payment_key);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
+       }
+
+       /**
+        * Returns the script for the counterparty's output on a holder's commitment transaction based on
+        * the channel type.
+        */
+       public static byte[] get_counterparty_payment_script(org.ldk.structs.ChannelTypeFeatures channel_type_features, byte[] payment_key) {
+               long ret = bindings.get_counterparty_payment_script(channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_key, 33)));
+               GC.KeepAlive(channel_type_features);
+               GC.KeepAlive(payment_key);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -362,11 +424,13 @@ public class UtilMethods {
         * does not need to have its previous_output_index filled.
         */
        public static byte[] get_htlc_redeemscript(org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, org.ldk.structs.TxCreationKeys keys) {
-               byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, keys == null ? 0 : keys.ptr);
+               long ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, keys == null ? 0 : keys.ptr);
                GC.KeepAlive(htlc);
                GC.KeepAlive(channel_type_features);
                GC.KeepAlive(keys);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -374,10 +438,12 @@ public class UtilMethods {
         * Note that the order of funding public keys does not matter.
         */
        public static byte[] make_funding_redeemscript(byte[] broadcaster, byte[] countersignatory) {
-               byte[] ret = bindings.make_funding_redeemscript(InternalUtils.check_arr_len(broadcaster, 33), InternalUtils.check_arr_len(countersignatory, 33));
+               long ret = bindings.make_funding_redeemscript(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(broadcaster, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(countersignatory, 33)));
                GC.KeepAlive(broadcaster);
                GC.KeepAlive(countersignatory);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -390,7 +456,7 @@ public class UtilMethods {
         * commitment transaction).
         */
        public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, org.ldk.structs.HTLCOutputInCommitment htlc, org.ldk.structs.ChannelTypeFeatures channel_type_features, byte[] broadcaster_delayed_payment_key, byte[] revocation_key) {
-               byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33));
+               long ret = bindings.build_htlc_transaction(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(commitment_txid, 32)), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(revocation_key, 33)));
                GC.KeepAlive(commitment_txid);
                GC.KeepAlive(feerate_per_kw);
                GC.KeepAlive(contest_delay);
@@ -398,29 +464,35 @@ public class UtilMethods {
                GC.KeepAlive(channel_type_features);
                GC.KeepAlive(broadcaster_delayed_payment_key);
                GC.KeepAlive(revocation_key);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Returns the witness required to satisfy and spend a HTLC input.
         */
-       public static byte[] build_htlc_input_witness(byte[] local_sig, byte[] remote_sig, org.ldk.structs.Option_PaymentPreimageZ preimage, byte[] redeem_script, org.ldk.structs.ChannelTypeFeatures channel_type_features) {
-               byte[] ret = bindings.build_htlc_input_witness(InternalUtils.check_arr_len(local_sig, 64), InternalUtils.check_arr_len(remote_sig, 64), preimage.ptr, redeem_script, channel_type_features == null ? 0 : channel_type_features.ptr);
+       public static byte[] build_htlc_input_witness(byte[] local_sig, byte[] remote_sig, org.ldk.structs.Option_ThirtyTwoBytesZ preimage, byte[] redeem_script, org.ldk.structs.ChannelTypeFeatures channel_type_features) {
+               long ret = bindings.build_htlc_input_witness(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(local_sig, 64)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(remote_sig, 64)), preimage.ptr, InternalUtils.encodeUint8Array(redeem_script), channel_type_features == null ? 0 : channel_type_features.ptr);
                GC.KeepAlive(local_sig);
                GC.KeepAlive(remote_sig);
                GC.KeepAlive(preimage);
                GC.KeepAlive(redeem_script);
                GC.KeepAlive(channel_type_features);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Gets the witnessScript for the to_remote output when anchors are enabled.
         */
        public static byte[] get_to_countersignatory_with_anchors_redeemscript(byte[] payment_point) {
-               byte[] ret = bindings.get_to_countersignatory_with_anchors_redeemscript(InternalUtils.check_arr_len(payment_point, 33));
+               long ret = bindings.get_to_countersignatory_with_anchors_redeemscript(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_point, 33)));
                GC.KeepAlive(payment_point);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -432,19 +504,23 @@ public class UtilMethods {
         * (empty vector required to satisfy compliance with MINIMALIF-standard rule)
         */
        public static byte[] get_anchor_redeemscript(byte[] funding_pubkey) {
-               byte[] ret = bindings.get_anchor_redeemscript(InternalUtils.check_arr_len(funding_pubkey, 33));
+               long ret = bindings.get_anchor_redeemscript(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_pubkey, 33)));
                GC.KeepAlive(funding_pubkey);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
         * Returns the witness required to satisfy and spend an anchor input.
         */
        public static byte[] build_anchor_input_witness(byte[] funding_key, byte[] funding_sig) {
-               byte[] ret = bindings.build_anchor_input_witness(InternalUtils.check_arr_len(funding_key, 33), InternalUtils.check_arr_len(funding_sig, 64));
+               long ret = bindings.build_anchor_input_witness(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_key, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(funding_sig, 64)));
                GC.KeepAlive(funding_key);
                GC.KeepAlive(funding_sig);
-               return ret;
+               if (ret >= 0 && ret <= 4096) { return null; }
+               byte[] ret_conv = InternalUtils.decodeUint8Array(ret);
+               return ret_conv;
        }
 
        /**
@@ -456,7 +532,7 @@ public class UtilMethods {
         * \"decrypt\" the commitment transaction number given a commitment transaction on-chain.
         */
        public static long get_commitment_transaction_number_obscure_factor(byte[] broadcaster_payment_basepoint, byte[] countersignatory_payment_basepoint, bool outbound_from_broadcaster) {
-               long ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33), InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33), outbound_from_broadcaster);
+               long ret = bindings.get_commitment_transaction_number_obscure_factor(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(broadcaster_payment_basepoint, 33)), InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(countersignatory_payment_basepoint, 33)), outbound_from_broadcaster);
                GC.KeepAlive(broadcaster_payment_basepoint);
                GC.KeepAlive(countersignatory_payment_basepoint);
                GC.KeepAlive(outbound_from_broadcaster);
@@ -467,7 +543,7 @@ public class UtilMethods {
         * Read a NetworkUpdate from a byte array, created by NetworkUpdate_write
         */
        public static Result_COption_NetworkUpdateZDecodeErrorZ NetworkUpdate_read(byte[] ser) {
-               long ret = bindings.NetworkUpdate_read(ser);
+               long ret = bindings.NetworkUpdate_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_NetworkUpdateZDecodeErrorZ ret_hu_conv = Result_COption_NetworkUpdateZDecodeErrorZ.constr_from_ptr(ret);
@@ -531,8 +607,8 @@ public class UtilMethods {
         * 
         * Note that first_hops (or a relevant inner pointer) may be NULL or all-0s to represent None
         */
-       public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, ChannelDetails[] first_hops, org.ldk.structs.Logger logger, org.ldk.structs.Score scorer, org.ldk.structs.ProbabilisticScoringFeeParameters score_params, byte[] random_seed_bytes) {
-               long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? InternalUtils.mapArray(first_hops, first_hops_conv_16 => first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr) : null, logger.ptr, scorer.ptr, score_params == null ? 0 : score_params.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
+       public static Result_RouteLightningErrorZ find_route(byte[] our_node_pubkey, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, ChannelDetails[] first_hops, org.ldk.structs.Logger logger, org.ldk.structs.ScoreLookUp scorer, org.ldk.structs.ProbabilisticScoringFeeParameters score_params, byte[] random_seed_bytes) {
+               long ret = bindings.find_route(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(our_node_pubkey, 33)), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(first_hops, first_hops_conv_16 => first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr)), logger.ptr, scorer.ptr, score_params == null ? 0 : score_params.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(random_seed_bytes, 32)));
                GC.KeepAlive(our_node_pubkey);
                GC.KeepAlive(route_params);
                GC.KeepAlive(network_graph);
@@ -559,7 +635,7 @@ public class UtilMethods {
         * Re-uses logic from `find_route`, so the restrictions described there also apply here.
         */
        public static Result_RouteLightningErrorZ build_route_from_hops(byte[] our_node_pubkey, byte[][] hops, org.ldk.structs.RouteParameters route_params, org.ldk.structs.NetworkGraph network_graph, org.ldk.structs.Logger logger, byte[] random_seed_bytes) {
-               long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? InternalUtils.mapArray(hops, hops_conv_8 => InternalUtils.check_arr_len(hops_conv_8, 33)) : null, route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
+               long ret = bindings.build_route_from_hops(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(our_node_pubkey, 33)), InternalUtils.encodeUint64Array(InternalUtils.mapArray(hops, hops_conv_8 => InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(hops_conv_8, 33)))), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, logger.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(random_seed_bytes, 32)));
                GC.KeepAlive(our_node_pubkey);
                GC.KeepAlive(hops);
                GC.KeepAlive(route_params);
@@ -592,20 +668,66 @@ public class UtilMethods {
         * 
         * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
         */
-       public static Result_C2Tuple_PartiallySignedTransactionusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_PackedLockTimeZ locktime) {
-               long ret = bindings.SpendableOutputDescriptor_create_spendable_outputs_psbt(descriptors != null ? InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr) : null, outputs != null ? InternalUtils.mapArray(outputs, outputs_conv_7 => outputs_conv_7.ptr) : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr);
+       public static Result_C2Tuple_CVec_u8ZusizeZNoneZ SpendableOutputDescriptor_create_spendable_outputs_psbt(SpendableOutputDescriptor[] descriptors, TxOut[] outputs, byte[] change_destination_script, int feerate_sat_per_1000_weight, org.ldk.structs.Option_u32Z locktime) {
+               long ret = bindings.SpendableOutputDescriptor_create_spendable_outputs_psbt(InternalUtils.encodeUint64Array(InternalUtils.mapArray(descriptors, descriptors_conv_27 => descriptors_conv_27.ptr)), InternalUtils.encodeUint64Array(InternalUtils.mapArray(outputs, outputs_conv_7 => outputs_conv_7.ptr)), InternalUtils.encodeUint8Array(change_destination_script), feerate_sat_per_1000_weight, locktime.ptr);
                GC.KeepAlive(descriptors);
                GC.KeepAlive(outputs);
                GC.KeepAlive(change_destination_script);
                GC.KeepAlive(feerate_sat_per_1000_weight);
                GC.KeepAlive(locktime);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_PartiallySignedTransactionusizeZNoneZ ret_hu_conv = Result_C2Tuple_PartiallySignedTransactionusizeZNoneZ.constr_from_ptr(ret);
+               Result_C2Tuple_CVec_u8ZusizeZNoneZ ret_hu_conv = Result_C2Tuple_CVec_u8ZusizeZNoneZ.constr_from_ptr(ret);
                foreach (SpendableOutputDescriptor descriptors_conv_27 in descriptors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(descriptors_conv_27); }; };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(locktime); };
                return ret_hu_conv;
        }
 
+       /**
+        * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
+        * `path`.
+        * 
+        * Returns both the node id of the peer to send the message to and the message itself.
+        * 
+        * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public static Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ create_onion_message(org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.OnionMessagePath path, org.ldk.structs.OnionMessageContents contents, org.ldk.structs.BlindedPath reply_path) {
+               long ret = bindings.create_onion_message(entropy_source.ptr, node_signer.ptr, path == null ? 0 : path.ptr, contents.ptr, reply_path == null ? 0 : reply_path.ptr);
+               GC.KeepAlive(entropy_source);
+               GC.KeepAlive(node_signer);
+               GC.KeepAlive(path);
+               GC.KeepAlive(contents);
+               GC.KeepAlive(reply_path);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ ret_hu_conv = Result_C2Tuple_PublicKeyOnionMessageZSendErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(path); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(contents); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(reply_path); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Decode one layer of an incoming [`OnionMessage`].
+        * 
+        * Returns either the next layer of the onion for forwarding or the decrypted content for the
+        * receiver.
+        */
+       public static Result_PeeledOnionNoneZ peel_onion_message(org.ldk.structs.OnionMessage msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.structs.CustomOnionMessageHandler custom_handler) {
+               long ret = bindings.peel_onion_message(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, custom_handler.ptr);
+               GC.KeepAlive(msg);
+               GC.KeepAlive(node_signer);
+               GC.KeepAlive(logger);
+               GC.KeepAlive(custom_handler);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_PeeledOnionNoneZ ret_hu_conv = Result_PeeledOnionNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(msg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(custom_handler); };
+               return ret_hu_conv;
+       }
+
        /**
         * Returns whether `tlv_type` corresponds to a TLV record for Offers.
         */
@@ -615,11 +737,26 @@ public class UtilMethods {
                return ret;
        }
 
+       /**
+        * Create a one-hop blinded path for a payment.
+        */
+       public static Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_one_hop_for_payment(byte[] payee_node_id, org.ldk.structs.ReceiveTlvs payee_tlvs, org.ldk.structs.EntropySource entropy_source) {
+               long ret = bindings.BlindedPath_one_hop_for_payment(InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payee_node_id, 33)), payee_tlvs == null ? 0 : payee_tlvs.ptr, entropy_source.ptr);
+               GC.KeepAlive(payee_node_id);
+               GC.KeepAlive(payee_tlvs);
+               GC.KeepAlive(entropy_source);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ ret_hu_conv = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(payee_tlvs); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(entropy_source); };
+               return ret_hu_conv;
+       }
+
        /**
         * Read a PathFailure from a byte array, created by PathFailure_write
         */
        public static Result_COption_PathFailureZDecodeErrorZ PathFailure_read(byte[] ser) {
-               long ret = bindings.PathFailure_read(ser);
+               long ret = bindings.PathFailure_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret);
@@ -630,7 +767,7 @@ public class UtilMethods {
         * Read a ClosureReason from a byte array, created by ClosureReason_write
         */
        public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) {
-               long ret = bindings.ClosureReason_read(ser);
+               long ret = bindings.ClosureReason_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
@@ -641,7 +778,7 @@ public class UtilMethods {
         * Read a HTLCDestination from a byte array, created by HTLCDestination_write
         */
        public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) {
-               long ret = bindings.HTLCDestination_read(ser);
+               long ret = bindings.HTLCDestination_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
@@ -652,7 +789,7 @@ public class UtilMethods {
         * Read a Event from a byte array, created by Event_write
         */
        public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) {
-               long ret = bindings.Event_read(ser);
+               long ret = bindings.Event_read(InternalUtils.encodeUint8Array(ser));
                GC.KeepAlive(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
@@ -668,13 +805,13 @@ public class UtilMethods {
         * 
         * If you wish to use a different payment idempotency token, see [`pay_invoice_with_id`].
         */
-       public static Result_PaymentIdPaymentErrorZ pay_invoice(org.ldk.structs.Bolt11Invoice invoice, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
+       public static Result_ThirtyTwoBytesPaymentErrorZ pay_invoice(org.ldk.structs.Bolt11Invoice invoice, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
                long ret = bindings.pay_invoice(invoice == null ? 0 : invoice.ptr, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
                GC.KeepAlive(invoice);
                GC.KeepAlive(retry_strategy);
                GC.KeepAlive(channelmanager);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret);
+               Result_ThirtyTwoBytesPaymentErrorZ ret_hu_conv = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(retry_strategy); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channelmanager); };
@@ -694,7 +831,7 @@ public class UtilMethods {
         * See [`pay_invoice`] for a variant which uses the [`PaymentHash`] for the idempotency token.
         */
        public static Result_NonePaymentErrorZ pay_invoice_with_id(org.ldk.structs.Bolt11Invoice invoice, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
-               long ret = bindings.pay_invoice_with_id(invoice == null ? 0 : invoice.ptr, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
+               long ret = bindings.pay_invoice_with_id(invoice == null ? 0 : invoice.ptr, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
                GC.KeepAlive(invoice);
                GC.KeepAlive(payment_id);
                GC.KeepAlive(retry_strategy);
@@ -718,14 +855,14 @@ public class UtilMethods {
         * If you wish to use a different payment idempotency token, see
         * [`pay_zero_value_invoice_with_id`].
         */
-       public static Result_PaymentIdPaymentErrorZ pay_zero_value_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msats, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
+       public static Result_ThirtyTwoBytesPaymentErrorZ pay_zero_value_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msats, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
                long ret = bindings.pay_zero_value_invoice(invoice == null ? 0 : invoice.ptr, amount_msats, retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
                GC.KeepAlive(invoice);
                GC.KeepAlive(amount_msats);
                GC.KeepAlive(retry_strategy);
                GC.KeepAlive(channelmanager);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PaymentIdPaymentErrorZ ret_hu_conv = Result_PaymentIdPaymentErrorZ.constr_from_ptr(ret);
+               Result_ThirtyTwoBytesPaymentErrorZ ret_hu_conv = Result_ThirtyTwoBytesPaymentErrorZ.constr_from_ptr(ret);
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(retry_strategy); };
                if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channelmanager); };
@@ -746,7 +883,7 @@ public class UtilMethods {
         * idempotency token.
         */
        public static Result_NonePaymentErrorZ pay_zero_value_invoice_with_id(org.ldk.structs.Bolt11Invoice invoice, long amount_msats, byte[] payment_id, org.ldk.structs.Retry retry_strategy, org.ldk.structs.ChannelManager channelmanager) {
-               long ret = bindings.pay_zero_value_invoice_with_id(invoice == null ? 0 : invoice.ptr, amount_msats, InternalUtils.check_arr_len(payment_id, 32), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
+               long ret = bindings.pay_zero_value_invoice_with_id(invoice == null ? 0 : invoice.ptr, amount_msats, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_id, 32)), retry_strategy.ptr, channelmanager == null ? 0 : channelmanager.ptr);
                GC.KeepAlive(invoice);
                GC.KeepAlive(amount_msats);
                GC.KeepAlive(payment_id);
@@ -760,6 +897,44 @@ public class UtilMethods {
                return ret_hu_conv;
        }
 
+       /**
+        * Sends payment probes over all paths of a route that would be used to pay the given invoice.
+        * 
+        * See [`ChannelManager::send_preflight_probes`] for more information.
+        */
+       public static Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_invoice(org.ldk.structs.Bolt11Invoice invoice, org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.Option_u64Z liquidity_limit_multiplier) {
+               long ret = bindings.preflight_probe_invoice(invoice == null ? 0 : invoice.ptr, channelmanager == null ? 0 : channelmanager.ptr, liquidity_limit_multiplier.ptr);
+               GC.KeepAlive(invoice);
+               GC.KeepAlive(channelmanager);
+               GC.KeepAlive(liquidity_limit_multiplier);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(liquidity_limit_multiplier); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Sends payment probes over all paths of a route that would be used to pay the given zero-value
+        * invoice using the given amount.
+        * 
+        * See [`ChannelManager::send_preflight_probes`] for more information.
+        */
+       public static Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ preflight_probe_zero_value_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msat, org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.Option_u64Z liquidity_limit_multiplier) {
+               long ret = bindings.preflight_probe_zero_value_invoice(invoice == null ? 0 : invoice.ptr, amount_msat, channelmanager == null ? 0 : channelmanager.ptr, liquidity_limit_multiplier.ptr);
+               GC.KeepAlive(invoice);
+               GC.KeepAlive(amount_msat);
+               GC.KeepAlive(channelmanager);
+               GC.KeepAlive(liquidity_limit_multiplier);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ ret_hu_conv = Result_CVec_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZZProbingErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(invoice); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.AddLast(liquidity_limit_multiplier); };
+               return ret_hu_conv;
+       }
+
        /**
         * Utility to create an invoice that can be paid to one of multiple nodes, or a \"phantom invoice.\"
         * See [`PhantomKeysManager`] for more information on phantom node payments.
@@ -802,8 +977,8 @@ public class UtilMethods {
         * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
         * available and the current time is supplied by the caller.
         */
-       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_PaymentHashZ payment_hash, string description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
-               long ret = bindings.create_phantom_invoice(amt_msat.ptr, payment_hash.ptr, description, invoice_expiry_delta_secs, phantom_route_hints != null ? InternalUtils.mapArray(phantom_route_hints, phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr) : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, string description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
+               long ret = bindings.create_phantom_invoice(amt_msat.ptr, payment_hash.ptr, InternalUtils.encodeString(description), invoice_expiry_delta_secs, InternalUtils.encodeUint64Array(InternalUtils.mapArray(phantom_route_hints, phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr)), entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
                GC.KeepAlive(amt_msat);
                GC.KeepAlive(payment_hash);
                GC.KeepAlive(description);
@@ -867,8 +1042,8 @@ public class UtilMethods {
         * This can be used in a `no_std` environment, where [`std::time::SystemTime`] is not
         * available and the current time is supplied by the caller.
         */
-       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_PaymentHashZ payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
-               long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, payment_hash.ptr, invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, phantom_route_hints != null ? InternalUtils.mapArray(phantom_route_hints, phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr) : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, int invoice_expiry_delta_secs, org.ldk.structs.Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, org.ldk.structs.EntropySource entropy_source, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta, long duration_since_epoch) {
+               long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, payment_hash.ptr, invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr, InternalUtils.encodeUint64Array(InternalUtils.mapArray(phantom_route_hints, phantom_route_hints_conv_19 => phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr)), entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
                GC.KeepAlive(amt_msat);
                GC.KeepAlive(payment_hash);
                GC.KeepAlive(invoice_expiry_delta_secs);
@@ -911,7 +1086,7 @@ public class UtilMethods {
         * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
         */
        public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u64Z amt_msat, string description, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
-               long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
+               long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, InternalUtils.encodeString(description), invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
                GC.KeepAlive(channelmanager);
                GC.KeepAlive(node_signer);
                GC.KeepAlive(logger);
@@ -1002,7 +1177,7 @@ public class UtilMethods {
         * available and the current time is supplied by the caller.
         */
        public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u64Z amt_msat, string description, long duration_since_epoch, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
-               long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
+               long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, InternalUtils.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
                GC.KeepAlive(channelmanager);
                GC.KeepAlive(node_signer);
                GC.KeepAlive(logger);
@@ -1029,7 +1204,7 @@ public class UtilMethods {
         * the payment hash is also involved outside the scope of lightning.
         */
        public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, Currency network, org.ldk.structs.Option_u64Z amt_msat, string description, long duration_since_epoch, int invoice_expiry_delta_secs, byte[] payment_hash, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
-               long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.check_arr_len(payment_hash, 32), min_final_cltv_expiry_delta.ptr);
+               long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch_with_payment_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, InternalUtils.encodeString(description), duration_since_epoch, invoice_expiry_delta_secs, InternalUtils.encodeUint8Array(InternalUtils.check_arr_len(payment_hash, 32)), min_final_cltv_expiry_delta.ptr);
                GC.KeepAlive(channelmanager);
                GC.KeepAlive(node_signer);
                GC.KeepAlive(logger);