[Java] Update auto-generated Java bindings to LDK 0.0.121
[ldk-java] / src / main / java / org / ldk / structs / UtilMethods.java
index 575a448aa27f02f45e01241e1dce16ee79c08b0b..156d1e93eed3c58265b116cc2969b22b38f55ff0 100644 (file)
@@ -8,51 +8,48 @@ import javax.annotation.Nullable;
 
 public class UtilMethods {
        /**
-        * Constructs a new COption_NoneZ containing a
+        * Gets the 128-bit integer, as 16 little-endian bytes
         */
-       public static COption_NoneZ COption_NoneZ_some() {
-               COption_NoneZ ret = bindings.COption_NoneZ_some();
+       public static byte[] U128_le_bytes(org.ldk.util.UInt128 val) {
+               byte[] ret = bindings.U128_le_bytes(val.getLEBytes());
+               Reference.reachabilityFence(val);
                return ret;
        }
 
        /**
-        * Constructs a new COption_NoneZ containing nothing
+        * Constructs a new U128 from 16 little-endian bytes
         */
-       public static COption_NoneZ COption_NoneZ_none() {
-               COption_NoneZ ret = bindings.COption_NoneZ_none();
-               return ret;
+       public static UInt128 U128_new(byte[] le_bytes) {
+               byte[] ret = bindings.U128_new(InternalUtils.check_arr_len(le_bytes, 16));
+               Reference.reachabilityFence(le_bytes);
+               org.ldk.util.UInt128 ret_conv = new org.ldk.util.UInt128(ret);
+               return ret_conv;
        }
 
        /**
-        * Read a ClosureReason from a byte array, created by ClosureReason_write
+        * Constructs a new COption_NoneZ containing a
         */
-       public static Result_COption_ClosureReasonZDecodeErrorZ ClosureReason_read(byte[] ser) {
-               long ret = bindings.ClosureReason_read(ser);
-               Reference.reachabilityFence(ser);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
+       public static COption_NoneZ COption_NoneZ_some() {
+               COption_NoneZ ret = bindings.COption_NoneZ_some();
+               return ret;
        }
 
        /**
-        * Read a HTLCDestination from a byte array, created by HTLCDestination_write
+        * Constructs a new COption_NoneZ containing nothing
         */
-       public static Result_COption_HTLCDestinationZDecodeErrorZ HTLCDestination_read(byte[] ser) {
-               long ret = bindings.HTLCDestination_read(ser);
-               Reference.reachabilityFence(ser);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
+       public static COption_NoneZ COption_NoneZ_none() {
+               COption_NoneZ ret = bindings.COption_NoneZ_none();
+               return ret;
        }
 
        /**
-        * Read a Event from a byte array, created by Event_write
+        * Read a APIError from a byte array, created by APIError_write
         */
-       public static Result_COption_EventZDecodeErrorZ Event_read(byte[] ser) {
-               long ret = bindings.Event_read(ser);
+       public static Result_COption_APIErrorZDecodeErrorZ APIError_read(byte[] ser) {
+               long ret = bindings.APIError_read(ser);
                Reference.reachabilityFence(ser);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
+               Result_COption_APIErrorZDecodeErrorZ ret_hu_conv = Result_COption_APIErrorZDecodeErrorZ.constr_from_ptr(ret);
                return ret_hu_conv;
        }
 
@@ -61,24 +58,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) {
+       public static Result_StrSecp256k1ErrorZ sign(byte[] msg, byte[] sk) {
                long ret = bindings.sign(msg, InternalUtils.check_arr_len(sk, 32));
                Reference.reachabilityFence(msg);
                Reference.reachabilityFence(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, java.lang.String sig) {
+       public static Result_PublicKeySecp256k1ErrorZ recover_pk(byte[] msg, java.lang.String sig) {
                long ret = bindings.recover_pk(msg, sig);
                Reference.reachabilityFence(msg);
                Reference.reachabilityFence(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;
        }
 
@@ -104,6 +101,22 @@ public class UtilMethods {
                return ret;
        }
 
+       /**
+        * 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);
+               Reference.reachabilityFence(kv_store);
+               Reference.reachabilityFence(entropy_source);
+               Reference.reachabilityFence(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.add(kv_store); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(signer_provider); };
+               return ret_hu_conv;
+       }
+
        /**
         * Read a MonitorEvent from a byte array, created by MonitorEvent_write
         */
@@ -116,40 +129,89 @@ 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, KeysInterface arg) {
-               long ret = bindings.C2Tuple_BlockHashChannelMonitorZ_read(ser, arg == null ? 0 : arg.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(ser, arg_a.ptr, arg_b.ptr);
                Reference.reachabilityFence(ser);
-               Reference.reachabilityFence(arg);
+               Reference.reachabilityFence(arg_a);
+               Reference.reachabilityFence(arg_b);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_a); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_b); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Peel one layer off an incoming onion, returning a [`PendingHTLCInfo`] that contains information
+        * about the intended next-hop for the HTLC.
+        * 
+        * This does all the relevant context-free checks that LDK requires for payment relay or
+        * acceptance. If the payment is to be received, and the amount matches the expected amount for
+        * a given invoice, this indicates the [`msgs::UpdateAddHTLC`], once fully committed in the
+        * channel, will generate an [`Event::PaymentClaimable`].
+        * 
+        * [`Event::PaymentClaimable`]: crate::events::Event::PaymentClaimable
+        */
+       public static Result_PendingHTLCInfoInboundHTLCErrZ peel_payment_onion(org.ldk.structs.UpdateAddHTLC msg, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, int cur_height, boolean accept_mpp_keysend, boolean allow_skimmed_fees) {
+               long ret = bindings.peel_payment_onion(msg == null ? 0 : msg.ptr, node_signer.ptr, logger.ptr, cur_height, accept_mpp_keysend, allow_skimmed_fees);
+               Reference.reachabilityFence(msg);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
+               Reference.reachabilityFence(cur_height);
+               Reference.reachabilityFence(accept_mpp_keysend);
+               Reference.reachabilityFence(allow_skimmed_fees);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_PendingHTLCInfoInboundHTLCErrZ ret_hu_conv = Result_PendingHTLCInfoInboundHTLCErrZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * 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) {
+               long ret = bindings.provided_init_features(config == null ? 0 : config.ptr);
+               Reference.reachabilityFence(config);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelMonitorZDecodeErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(arg);
+               org.ldk.structs.InitFeatures ret_hu_conv = null; if (ret < 0 || ret > 4096) { ret_hu_conv = new org.ldk.structs.InitFeatures(null, ret); }
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(config); };
                return ret_hu_conv;
        }
 
        /**
-        * 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, KeysInterface arg_keys_manager, FeeEstimator arg_fee_estimator, Watch arg_chain_monitor, BroadcasterInterface arg_tx_broadcaster, Logger arg_logger, UserConfig arg_default_config, ChannelMonitor[] arg_channel_monitors) {
-               long ret = bindings.C2Tuple_BlockHashChannelManagerZ_read(ser, bindings.ChannelManagerReadArgs_new(arg_keys_manager == null ? 0 : arg_keys_manager.ptr, arg_fee_estimator == null ? 0 : arg_fee_estimator.ptr, arg_chain_monitor == null ? 0 : arg_chain_monitor.ptr, arg_tx_broadcaster == null ? 0 : arg_tx_broadcaster.ptr, arg_logger == null ? 0 : arg_logger.ptr, arg_default_config == null ? 0 : arg_default_config.ptr & ~1, arg_channel_monitors != null ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr & ~1).toArray() : 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(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 ? Arrays.stream(arg_channel_monitors).mapToLong(arg_channel_monitors_conv_16 -> arg_channel_monitors_conv_16 == null ? 0 : arg_channel_monitors_conv_16.ptr).toArray() : null));
                Reference.reachabilityFence(ser);
-               Reference.reachabilityFence(arg_keys_manager);
+               Reference.reachabilityFence(arg_entropy_source);
+               Reference.reachabilityFence(arg_node_signer);
+               Reference.reachabilityFence(arg_signer_provider);
                Reference.reachabilityFence(arg_fee_estimator);
                Reference.reachabilityFence(arg_chain_monitor);
                Reference.reachabilityFence(arg_tx_broadcaster);
+               Reference.reachabilityFence(arg_router);
                Reference.reachabilityFence(arg_logger);
                Reference.reachabilityFence(arg_default_config);
                Reference.reachabilityFence(arg_channel_monitors);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_BlockHashChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(arg_keys_manager);
-               ret_hu_conv.ptrs_to.add(arg_fee_estimator);
-               ret_hu_conv.ptrs_to.add(arg_chain_monitor);
-               ret_hu_conv.ptrs_to.add(arg_tx_broadcaster);
-               ret_hu_conv.ptrs_to.add(arg_logger);
-               ;
-               for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); };
+               Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesChannelManagerZDecodeErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_signer_provider); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_fee_estimator); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_chain_monitor); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_tx_broadcaster); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_router); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_default_config); };
+               for (ChannelMonitor arg_channel_monitors_conv_16: arg_channel_monitors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_channel_monitors_conv_16); }; };
                return ret_hu_conv;
        }
 
@@ -158,25 +220,32 @@ public class UtilMethods {
         * `ChannelManager` is required. Useful for generating invoices for [phantom node payments] without
         * a `ChannelManager`.
         * 
-        * `keys` is generated by calling [`KeysInterface::get_inbound_payment_key_material`] and then
+        * `keys` is generated by calling [`NodeSigner::get_inbound_payment_key_material`] and then
         * calling [`ExpandedKey::new`] with its result. It is recommended to cache this value and not
         * regenerate it for each new inbound payment.
         * 
         * `current_time` is a Unix timestamp representing the current time.
         * 
-        * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+        * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
+        * on versions of LDK prior to 0.0.114.
+        * 
+        * [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(ExpandedKey keys, Option_u64Z min_value_msat, int invoice_expiry_delta_secs, KeysInterface keys_manager, long current_time) {
-               long ret = bindings.create(keys == null ? 0 : keys.ptr & ~1, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time);
+       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);
                Reference.reachabilityFence(keys);
                Reference.reachabilityFence(min_value_msat);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(entropy_source);
                Reference.reachabilityFence(current_time);
+               Reference.reachabilityFence(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);
-               ret_hu_conv.ptrs_to.add(keys);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ ret_hu_conv = Result_C2Tuple_ThirtyTwoBytesThirtyTwoBytesZNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -187,39 +256,71 @@ public class UtilMethods {
         * 
         * See [`create`] for information on the `keys` and `current_time` parameters.
         * 
-        * [phantom node payments]: crate::chain::keysinterface::PhantomKeysManager
+        * Note that if `min_final_cltv_expiry_delta` is set to some value, then the payment will not be receivable
+        * on versions of LDK prior to 0.0.114.
+        * 
+        * [phantom node payments]: crate::sign::PhantomKeysManager
         */
-       public static Result_PaymentSecretNoneZ create_from_hash(ExpandedKey keys, Option_u64Z min_value_msat, byte[] payment_hash, int invoice_expiry_delta_secs, long current_time) {
-               long ret = bindings.create_from_hash(keys == null ? 0 : keys.ptr & ~1, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time);
+       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.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time, min_final_cltv_expiry_delta.ptr);
                Reference.reachabilityFence(keys);
                Reference.reachabilityFence(min_value_msat);
                Reference.reachabilityFence(payment_hash);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
                Reference.reachabilityFence(current_time);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(keys);
+               Result_ThirtyTwoBytesNoneZ ret_hu_conv = Result_ThirtyTwoBytesNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_value_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(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(java.lang.String host, short port) {
+               long ret = bindings.parse_onion_address(host, port);
+               Reference.reachabilityFence(host);
+               Reference.reachabilityFence(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.
         */
-       public static long htlc_success_tx_weight(boolean opt_anchors) {
-               long ret = bindings.htlc_success_tx_weight(opt_anchors);
-               Reference.reachabilityFence(opt_anchors);
+       public static long htlc_success_tx_weight(org.ldk.structs.ChannelTypeFeatures channel_type_features) {
+               long ret = bindings.htlc_success_tx_weight(channel_type_features == null ? 0 : channel_type_features.ptr);
+               Reference.reachabilityFence(channel_type_features);
                return ret;
        }
 
        /**
         * Gets the weight for an HTLC-Timeout transaction.
         */
-       public static long htlc_timeout_tx_weight(boolean opt_anchors) {
-               long ret = bindings.htlc_timeout_tx_weight(opt_anchors);
-               Reference.reachabilityFence(opt_anchors);
+       public static long htlc_timeout_tx_weight(org.ldk.structs.ChannelTypeFeatures channel_type_features) {
+               long ret = bindings.htlc_timeout_tx_weight(channel_type_features == null ? 0 : channel_type_features.ptr);
+               Reference.reachabilityFence(channel_type_features);
                return ret;
        }
 
+       /**
+        * 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);
+               Reference.reachabilityFence(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);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(ret_hu_conv); };
+               return ret_hu_conv;
+       }
+
        /**
         * Build the commitment secret from the seed and the commitment number
         */
@@ -233,8 +334,8 @@ public class UtilMethods {
        /**
         * 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, 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 & ~1);
+       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);
                Reference.reachabilityFence(to_holder_value_sat);
                Reference.reachabilityFence(to_counterparty_value_sat);
                Reference.reachabilityFence(to_holder_script);
@@ -246,34 +347,12 @@ public class UtilMethods {
        /**
         * Derives a per-commitment-transaction private key (eg an htlc key or delayed_payment key)
         * from the base secret and the per_commitment_point.
-        * 
-        * Note that this is infallible iff we trust that at least one of the two input keys are randomly
-        * generated (ie our own).
         */
-       public static Result_SecretKeyErrorZ derive_private_key(byte[] per_commitment_point, byte[] base_secret) {
-               long ret = bindings.derive_private_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_secret, 32));
+       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));
                Reference.reachabilityFence(per_commitment_point);
                Reference.reachabilityFence(base_secret);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
-       }
-
-       /**
-        * Derives a per-commitment-transaction public key (eg an htlc key or a delayed_payment key)
-        * from the base point and the per_commitment_key. This is the public equivalent of
-        * derive_private_key - using only public keys to derive a public key instead of private keys.
-        * 
-        * Note that this is infallible iff we trust that at least one of the two input keys are randomly
-        * generated (ie our own).
-        */
-       public static Result_PublicKeyErrorZ derive_public_key(byte[] per_commitment_point, byte[] base_point) {
-               long ret = bindings.derive_public_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(base_point, 33));
-               Reference.reachabilityFence(per_commitment_point);
-               Reference.reachabilityFence(base_point);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
+               return ret;
        }
 
        /**
@@ -283,39 +362,12 @@ public class UtilMethods {
         * commitment transaction, thus per_commitment_secret always come from cheater
         * and revocation_base_secret always come from punisher, which is the broadcaster
         * of the transaction spending with this key knowledge.
-        * 
-        * Note that this is infallible iff we trust that at least one of the two input keys are randomly
-        * generated (ie our own).
         */
-       public static Result_SecretKeyErrorZ derive_private_revocation_key(byte[] per_commitment_secret, byte[] countersignatory_revocation_base_secret) {
-               long ret = bindings.derive_private_revocation_key(InternalUtils.check_arr_len(per_commitment_secret, 32), InternalUtils.check_arr_len(countersignatory_revocation_base_secret, 32));
+       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));
                Reference.reachabilityFence(per_commitment_secret);
                Reference.reachabilityFence(countersignatory_revocation_base_secret);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_SecretKeyErrorZ ret_hu_conv = Result_SecretKeyErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
-       }
-
-       /**
-        * Derives a per-commitment-transaction revocation public key from its constituent parts. This is
-        * the public equivalend of derive_private_revocation_key - using only public keys to derive a
-        * public key instead of private keys.
-        * 
-        * Only the cheating participant owns a valid witness to propagate a revoked
-        * commitment transaction, thus per_commitment_point always come from cheater
-        * and revocation_base_point always come from punisher, which is the broadcaster
-        * of the transaction spending with this key knowledge.
-        * 
-        * Note that this is infallible iff we trust that at least one of the two input keys are randomly
-        * generated (ie our own).
-        */
-       public static Result_PublicKeyErrorZ derive_public_revocation_key(byte[] per_commitment_point, byte[] countersignatory_revocation_base_point) {
-               long ret = bindings.derive_public_revocation_key(InternalUtils.check_arr_len(per_commitment_point, 33), InternalUtils.check_arr_len(countersignatory_revocation_base_point, 33));
-               Reference.reachabilityFence(per_commitment_point);
-               Reference.reachabilityFence(countersignatory_revocation_base_point);
-               if (ret >= 0 && ret <= 4096) { return null; }
-               Result_PublicKeyErrorZ ret_hu_conv = Result_PublicKeyErrorZ.constr_from_ptr(ret);
-               return ret_hu_conv;
+               return ret;
        }
 
        /**
@@ -323,22 +375,33 @@ public class UtilMethods {
         * key or the broadcaster_delayed_payment_key and satisfying the relative-locktime OP_CSV constrain.
         * 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));
+       public static byte[] get_revokeable_redeemscript(org.ldk.structs.RevocationKey revocation_key, short contest_delay, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key) {
+               byte[] ret = bindings.get_revokeable_redeemscript(revocation_key == null ? 0 : revocation_key.ptr, contest_delay, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr);
                Reference.reachabilityFence(revocation_key);
                Reference.reachabilityFence(contest_delay);
                Reference.reachabilityFence(broadcaster_delayed_payment_key);
                return ret;
        }
 
+       /**
+        * 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) {
+               byte[] ret = bindings.get_counterparty_payment_script(channel_type_features == null ? 0 : channel_type_features.ptr, InternalUtils.check_arr_len(payment_key, 33));
+               Reference.reachabilityFence(channel_type_features);
+               Reference.reachabilityFence(payment_key);
+               return ret;
+       }
+
        /**
         * Gets the witness redeemscript for an HTLC output in a commitment transaction. Note that htlc
         * does not need to have its previous_output_index filled.
         */
-       public static byte[] get_htlc_redeemscript(HTLCOutputInCommitment htlc, boolean opt_anchors, TxCreationKeys keys) {
-               byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr & ~1, opt_anchors, keys == null ? 0 : keys.ptr & ~1);
+       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);
                Reference.reachabilityFence(htlc);
-               Reference.reachabilityFence(opt_anchors);
+               Reference.reachabilityFence(channel_type_features);
                Reference.reachabilityFence(keys);
                return ret;
        }
@@ -363,18 +426,40 @@ public class UtilMethods {
         * Panics if htlc.transaction_output_index.is_none() (as such HTLCs do not appear in the
         * commitment transaction).
         */
-       public static byte[] build_htlc_transaction(byte[] commitment_txid, int feerate_per_kw, short contest_delay, HTLCOutputInCommitment htlc, boolean opt_anchors, 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 & ~1, opt_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33));
+       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, org.ldk.structs.DelayedPaymentKey broadcaster_delayed_payment_key, org.ldk.structs.RevocationKey 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, broadcaster_delayed_payment_key == null ? 0 : broadcaster_delayed_payment_key.ptr, revocation_key == null ? 0 : revocation_key.ptr);
                Reference.reachabilityFence(commitment_txid);
                Reference.reachabilityFence(feerate_per_kw);
                Reference.reachabilityFence(contest_delay);
                Reference.reachabilityFence(htlc);
-               Reference.reachabilityFence(opt_anchors);
+               Reference.reachabilityFence(channel_type_features);
                Reference.reachabilityFence(broadcaster_delayed_payment_key);
                Reference.reachabilityFence(revocation_key);
                return ret;
        }
 
+       /**
+        * 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_ThirtyTwoBytesZ 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);
+               Reference.reachabilityFence(local_sig);
+               Reference.reachabilityFence(remote_sig);
+               Reference.reachabilityFence(preimage);
+               Reference.reachabilityFence(redeem_script);
+               Reference.reachabilityFence(channel_type_features);
+               return ret;
+       }
+
+       /**
+        * 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));
+               Reference.reachabilityFence(payment_point);
+               return ret;
+       }
+
        /**
         * Gets the witnessScript for an anchor output from the funding public key.
         * The witness in the spending input must be:
@@ -389,6 +474,16 @@ public class UtilMethods {
                return ret;
        }
 
+       /**
+        * 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));
+               Reference.reachabilityFence(funding_key);
+               Reference.reachabilityFence(funding_sig);
+               return ret;
+       }
+
        /**
         * Commitment transaction numbers which appear in the transactions themselves are XOR'd with a
         * shared secret first. This prevents on-chain observers from discovering how many commitment
@@ -416,13 +511,43 @@ public class UtilMethods {
                return ret_hu_conv;
        }
 
+       /**
+        * Verifies the signature of a [`NodeAnnouncement`].
+        * 
+        * Returns an error if it is invalid.
+        */
+       public static Result_NoneLightningErrorZ verify_node_announcement(org.ldk.structs.NodeAnnouncement msg) {
+               long ret = bindings.verify_node_announcement(msg == null ? 0 : msg.ptr);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Verifies all signatures included in a [`ChannelAnnouncement`].
+        * 
+        * Returns an error if one of the signatures is invalid.
+        */
+       public static Result_NoneLightningErrorZ verify_channel_announcement(org.ldk.structs.ChannelAnnouncement msg) {
+               long ret = bindings.verify_channel_announcement(msg == null ? 0 : msg.ptr);
+               Reference.reachabilityFence(msg);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_NoneLightningErrorZ ret_hu_conv = Result_NoneLightningErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(msg); };
+               return ret_hu_conv;
+       }
+
        /**
         * Finds a route from us (payer) to the given target node (payee).
         * 
-        * If the payee provided features in their invoice, they should be provided via `params.payee`.
+        * If the payee provided features in their invoice, they should be provided via the `payee` field
+        * in the given [`RouteParameters::payment_params`].
         * Without this, MPP will only be used if the payee's features are available in the network graph.
         * 
-        * Private routing paths between a public node and the target may be included in `params.payee`.
+        * Private routing paths between a public node and the target may be included in the `payee` field
+        * of [`RouteParameters::payment_params`].
         * 
         * If some channels aren't announced, it may be useful to fill in `first_hops` with the results
         * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
@@ -432,39 +557,35 @@ public class UtilMethods {
         * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
         * `htlc_maximum_msat` *are* checked as they may change based on the receiving node.
         * 
-        * # Note
-        * 
-        * May be used to re-compute a [`Route`] when handling a [`Event::PaymentPathFailed`]. Any
-        * adjustments to the [`NetworkGraph`] and channel scores should be made prior to calling this
-        * function.
-        * 
         * # Panics
         * 
-        * Panics if first_hops contains channels without short_channel_ids;
+        * Panics if first_hops contains channels without `short_channel_id`s;
         * [`ChannelManager::list_usable_channels`] will never include such channels.
         * 
         * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
-        * [`Event::PaymentPathFailed`]: crate::util::events::Event::PaymentPathFailed
+        * [`Event::PaymentPathFailed`]: crate::events::Event::PaymentPathFailed
         * [`NetworkGraph`]: crate::routing::gossip::NetworkGraph
         * 
         * 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, RouteParameters route_params, NetworkGraph network_graph, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer, byte[] random_seed_bytes) {
-               long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr & ~1, network_graph == null ? 0 : network_graph.ptr & ~1, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr & ~1).toArray() : null, logger == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.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, @Nullable 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.check_arr_len(our_node_pubkey, 33), route_params == null ? 0 : route_params.ptr, network_graph == null ? 0 : network_graph.ptr, first_hops != null ? Arrays.stream(first_hops).mapToLong(first_hops_conv_16 -> first_hops_conv_16 == null ? 0 : first_hops_conv_16.ptr).toArray() : null, logger.ptr, scorer.ptr, score_params == null ? 0 : score_params.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
                Reference.reachabilityFence(our_node_pubkey);
                Reference.reachabilityFence(route_params);
                Reference.reachabilityFence(network_graph);
                Reference.reachabilityFence(first_hops);
                Reference.reachabilityFence(logger);
                Reference.reachabilityFence(scorer);
+               Reference.reachabilityFence(score_params);
                Reference.reachabilityFence(random_seed_bytes);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(route_params);
-               ret_hu_conv.ptrs_to.add(network_graph);
-               for (ChannelDetails first_hops_conv_16: first_hops) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); };
-               ret_hu_conv.ptrs_to.add(logger);
-               ret_hu_conv.ptrs_to.add(scorer);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
+               if (first_hops != null) { for (ChannelDetails first_hops_conv_16: first_hops) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(first_hops_conv_16); }; } };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(scorer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(score_params); };
                return ret_hu_conv;
        }
 
@@ -474,8 +595,8 @@ 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, RouteParameters route_params, NetworkGraph network_graph, Logger logger, byte[] random_seed_bytes) {
-               long ret = bindings.build_route_from_hops(InternalUtils.check_arr_len(our_node_pubkey, 33), hops != null ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : null, route_params == null ? 0 : route_params.ptr & ~1, network_graph == null ? 0 : network_graph.ptr & ~1, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
+       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 ? Arrays.stream(hops).map(hops_conv_8 -> InternalUtils.check_arr_len(hops_conv_8, 33)).toArray(byte[][]::new) : 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));
                Reference.reachabilityFence(our_node_pubkey);
                Reference.reachabilityFence(hops);
                Reference.reachabilityFence(route_params);
@@ -484,9 +605,227 @@ public class UtilMethods {
                Reference.reachabilityFence(random_seed_bytes);
                if (ret >= 0 && ret <= 4096) { return null; }
                Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(route_params);
-               ret_hu_conv.ptrs_to.add(network_graph);
-               ret_hu_conv.ptrs_to.add(logger);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(route_params); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(network_graph); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates an unsigned [`PartiallySignedTransaction`] which spends the given descriptors to
+        * the given outputs, plus an output to the given change destination (if sufficient
+        * change value remains). The PSBT will have a feerate, at least, of the given value.
+        * 
+        * The `locktime` argument is used to set the transaction's locktime. If `None`, the
+        * transaction will have a locktime of 0. It it recommended to set this to the current block
+        * height to avoid fee sniping, unless you have some specific reason to use a different
+        * locktime.
+        * 
+        * Returns the PSBT and expected max transaction weight.
+        * 
+        * Returns `Err(())` if the output value is greater than the input value minus required fee,
+        * if a descriptor was duplicated, or if an output descriptor `script_pubkey`
+        * does not match the one we can spend.
+        * 
+        * We do not enforce that outputs meet the dust limit or that any output scripts are standard.
+        */
+       public static Result_C2Tuple_CVec_u8Zu64ZNoneZ 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(descriptors != null ? Arrays.stream(descriptors).mapToLong(descriptors_conv_27 -> descriptors_conv_27.ptr).toArray() : null, outputs != null ? Arrays.stream(outputs).mapToLong(outputs_conv_7 -> outputs_conv_7.ptr).toArray() : null, change_destination_script, feerate_sat_per_1000_weight, locktime.ptr);
+               Reference.reachabilityFence(descriptors);
+               Reference.reachabilityFence(outputs);
+               Reference.reachabilityFence(change_destination_script);
+               Reference.reachabilityFence(feerate_sat_per_1000_weight);
+               Reference.reachabilityFence(locktime);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_CVec_u8Zu64ZNoneZ ret_hu_conv = Result_C2Tuple_CVec_u8Zu64ZNoneZ.constr_from_ptr(ret);
+               for (SpendableOutputDescriptor descriptors_conv_27: descriptors) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(descriptors_conv_27); }; };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(locktime); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Creates an [`OnionMessage`] with the given `contents` for sending to the destination of
+        * `path`.
+        * 
+        * Returns the node id of the peer to send the message to, the message itself, and any addresses
+        * need to connect to the first node.
+        * 
+        * Note that reply_path (or a relevant inner pointer) may be NULL or all-0s to represent None
+        */
+       public static Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ 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, @Nullable 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);
+               Reference.reachabilityFence(entropy_source);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(path);
+               Reference.reachabilityFence(contents);
+               Reference.reachabilityFence(reply_path);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ ret_hu_conv = Result_C3Tuple_PublicKeyOnionMessageCOption_CVec_SocketAddressZZZSendErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(path); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(contents); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(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);
+               Reference.reachabilityFence(msg);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
+               Reference.reachabilityFence(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.add(msg); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(custom_handler); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Returns whether `tlv_type` corresponds to a TLV record for Offers.
+        */
+       public static boolean OffersMessage_is_known_type(long tlv_type) {
+               boolean ret = bindings.OffersMessage_is_known_type(tlv_type);
+               Reference.reachabilityFence(tlv_type);
+               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.check_arr_len(payee_node_id, 33), payee_tlvs == null ? 0 : payee_tlvs.ptr, entropy_source.ptr);
+               Reference.reachabilityFence(payee_node_id);
+               Reference.reachabilityFence(payee_tlvs);
+               Reference.reachabilityFence(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.add(payee_tlvs); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Create a blinded path for a payment, to be forwarded along `intermediate_nodes`.
+        * 
+        * Errors if:
+        * a provided node id is invalid
+        * [`BlindedPayInfo`] calculation results in an integer overflow
+        * any unknown features are required in the provided [`ForwardTlvs`]
+        * 
+        * [`ForwardTlvs`]: crate::blinded_path::payment::ForwardTlvs
+        */
+       public static Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ BlindedPath_new_for_payment(ForwardNode[] intermediate_nodes, byte[] payee_node_id, org.ldk.structs.ReceiveTlvs payee_tlvs, long htlc_maximum_msat, org.ldk.structs.EntropySource entropy_source) {
+               long ret = bindings.BlindedPath_new_for_payment(intermediate_nodes != null ? Arrays.stream(intermediate_nodes).mapToLong(intermediate_nodes_conv_13 -> intermediate_nodes_conv_13 == null ? 0 : intermediate_nodes_conv_13.ptr).toArray() : null, InternalUtils.check_arr_len(payee_node_id, 33), payee_tlvs == null ? 0 : payee_tlvs.ptr, htlc_maximum_msat, entropy_source.ptr);
+               Reference.reachabilityFence(intermediate_nodes);
+               Reference.reachabilityFence(payee_node_id);
+               Reference.reachabilityFence(payee_tlvs);
+               Reference.reachabilityFence(htlc_maximum_msat);
+               Reference.reachabilityFence(entropy_source);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ ret_hu_conv = Result_C2Tuple_BlindedPayInfoBlindedPathZNoneZ.constr_from_ptr(ret);
+               for (ForwardNode intermediate_nodes_conv_13: intermediate_nodes) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(intermediate_nodes_conv_13); }; };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payee_tlvs); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(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);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_COption_PathFailureZDecodeErrorZ ret_hu_conv = Result_COption_PathFailureZDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * 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);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_COption_ClosureReasonZDecodeErrorZ ret_hu_conv = Result_COption_ClosureReasonZDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * 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);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_COption_HTLCDestinationZDecodeErrorZ ret_hu_conv = Result_COption_HTLCDestinationZDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * 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);
+               Reference.reachabilityFence(ser);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_COption_EventZDecodeErrorZ ret_hu_conv = Result_COption_EventZDecodeErrorZ.constr_from_ptr(ret);
+               return ret_hu_conv;
+       }
+
+       /**
+        * Builds the necessary parameters to pay or pre-flight probe the given zero-amount
+        * [`Bolt11Invoice`] using [`ChannelManager::send_payment`] or
+        * [`ChannelManager::send_preflight_probes`].
+        * 
+        * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
+        * same [`PaymentHash`] has never been paid before.
+        * 
+        * Will always succeed unless the invoice has an amount specified, in which case
+        * [`payment_parameters_from_invoice`] should be used.
+        * 
+        * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
+        * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
+        */
+       public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_zero_amount_invoice(org.ldk.structs.Bolt11Invoice invoice, long amount_msat) {
+               long ret = bindings.payment_parameters_from_zero_amount_invoice(invoice == null ? 0 : invoice.ptr, amount_msat);
+               Reference.reachabilityFence(invoice);
+               Reference.reachabilityFence(amount_msat);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Builds the necessary parameters to pay or pre-flight probe the given [`Bolt11Invoice`] using
+        * [`ChannelManager::send_payment`] or [`ChannelManager::send_preflight_probes`].
+        * 
+        * Prior to paying, you must ensure that the [`Bolt11Invoice::payment_hash`] is unique and the
+        * same [`PaymentHash`] has never been paid before.
+        * 
+        * Will always succeed unless the invoice has no amount specified, in which case
+        * [`payment_parameters_from_zero_amount_invoice`] should be used.
+        * 
+        * [`ChannelManager::send_payment`]: lightning::ln::channelmanager::ChannelManager::send_payment
+        * [`ChannelManager::send_preflight_probes`]: lightning::ln::channelmanager::ChannelManager::send_preflight_probes
+        */
+       public static Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ payment_parameters_from_invoice(org.ldk.structs.Bolt11Invoice invoice) {
+               long ret = bindings.payment_parameters_from_invoice(invoice == null ? 0 : invoice.ptr);
+               Reference.reachabilityFence(invoice);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ ret_hu_conv = Result_C3Tuple_ThirtyTwoBytesRecipientOnionFieldsRouteParametersZNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(invoice); };
                return ret_hu_conv;
        }
 
@@ -511,30 +850,49 @@ public class UtilMethods {
         * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
         * in excess of the current time.
         * 
-        * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
+        * `duration_since_epoch` is the current time since epoch in seconds.
+        * 
+        * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
+        * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`] - 3.
+        * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
+        * confirmations during routing.
+        * 
+        * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
         * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
         * requirement).
         * 
-        * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
+        * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
         * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
         * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
         * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
         * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
+        * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
         * 
-        * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
+        * 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_InvoiceSignOrCreationErrorZ create_phantom_invoice(Option_u64Z amt_msat, @Nullable byte[] payment_hash, java.lang.String description, int invoice_expiry_delta_secs, PhantomRouteHints[] phantom_route_hints, KeysInterface keys_manager, org.ldk.enums.Currency network) {
-               long ret = bindings.create_phantom_invoice(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), description, invoice_expiry_delta_secs, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr & ~1).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, network);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_phantom_invoice(org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Option_ThirtyTwoBytesZ payment_hash, java.lang.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, org.ldk.enums.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 ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(payment_hash);
                Reference.reachabilityFence(description);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
                Reference.reachabilityFence(phantom_route_hints);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(entropy_source);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
+               Reference.reachabilityFence(duration_since_epoch);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
+               for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -548,9 +906,11 @@ public class UtilMethods {
         * participating node
         * It is fine to cache `phantom_route_hints` and reuse it across invoices, as long as the data is
         * updated when a channel becomes disabled or closes
-        * Note that if too many channels are included in [`PhantomRouteHints::channels`], the invoice
-        * may be too long for QR code scanning. To fix this, `PhantomRouteHints::channels` may be pared
-        * down
+        * Note that the route hints generated from `phantom_route_hints` will be limited to a maximum
+        * of 3 hints to ensure that the invoice can be scanned in a QR code. These hints are selected
+        * in the order that the nodes in `PhantomRouteHints` are specified, selecting one hint per node
+        * until the maximum is hit. Callers may provide as many `PhantomRouteHints::channels` as
+        * desired, but note that some nodes will be trimmed if more than 3 nodes are provided.
         * 
         * `description_hash` is a SHA-256 hash of the description text
         * 
@@ -561,30 +921,44 @@ public class UtilMethods {
         * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
         * in excess of the current time.
         * 
-        * Note that the provided `keys_manager`'s `KeysInterface` implementation must support phantom
+        * `duration_since_epoch` is the current time since epoch in seconds.
+        * 
+        * Note that the provided `keys_manager`'s `NodeSigner` implementation must support phantom
         * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
         * requirement).
         * 
-        * [`PhantomKeysManager`]: lightning::chain::keysinterface::PhantomKeysManager
+        * [`PhantomKeysManager`]: lightning::sign::PhantomKeysManager
         * [`ChannelManager::get_phantom_route_hints`]: lightning::ln::channelmanager::ChannelManager::get_phantom_route_hints
         * [`ChannelManager::create_inbound_payment`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment
         * [`ChannelManager::create_inbound_payment_for_hash`]: lightning::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash
         * [`PhantomRouteHints::channels`]: lightning::ln::channelmanager::PhantomRouteHints::channels
         * 
-        * Note that payment_hash (or a relevant inner pointer) may be NULL or all-0s to represent None
+        * 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_InvoiceSignOrCreationErrorZ create_phantom_invoice_with_description_hash(Option_u64Z amt_msat, @Nullable byte[] payment_hash, int invoice_expiry_delta_secs, Sha256 description_hash, PhantomRouteHints[] phantom_route_hints, KeysInterface keys_manager, org.ldk.enums.Currency network) {
-               long ret = bindings.create_phantom_invoice_with_description_hash(amt_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, description_hash == null ? 0 : description_hash.ptr & ~1, phantom_route_hints != null ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr & ~1).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, network);
+       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, org.ldk.enums.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 ? Arrays.stream(phantom_route_hints).mapToLong(phantom_route_hints_conv_19 -> phantom_route_hints_conv_19 == null ? 0 : phantom_route_hints_conv_19.ptr).toArray() : null, entropy_source.ptr, node_signer.ptr, logger.ptr, network, min_final_cltv_expiry_delta.ptr, duration_since_epoch);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(payment_hash);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
                Reference.reachabilityFence(description_hash);
                Reference.reachabilityFence(phantom_route_hints);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(entropy_source);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
+               Reference.reachabilityFence(duration_since_epoch);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(payment_hash); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
+               for (PhantomRouteHints phantom_route_hints_conv_19: phantom_route_hints) { if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(phantom_route_hints_conv_19); }; };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(entropy_source); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -597,19 +971,31 @@ public class UtilMethods {
         * 
         * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
         * in excess of the current time.
+        * 
+        * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
+        * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
+        * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
+        * confirmations during routing.
+        * 
+        * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
         */
-       public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, java.lang.String description, int invoice_expiry_delta_secs) {
-               long ret = bindings.create_invoice_from_channelmanager(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.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);
                Reference.reachabilityFence(channelmanager);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(description);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(channelmanager);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -623,19 +1009,32 @@ public class UtilMethods {
         * 
         * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
         * in excess of the current time.
+        * 
+        * You can specify a custom `min_final_cltv_expiry_delta`, or let LDK default it to
+        * [`MIN_FINAL_CLTV_EXPIRY_DELTA`]. The provided expiry must be at least [`MIN_FINAL_CLTV_EXPIRY_DELTA`].
+        * Note that LDK will add a buffer of 3 blocks to the delta to allow for up to a few new block
+        * confirmations during routing.
+        * 
+        * [`MIN_FINAL_CLTV_EXPIRY_DETLA`]: lightning::ln::channelmanager::MIN_FINAL_CLTV_EXPIRY_DELTA
         */
-       public static Result_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, Sha256 description_hash, int invoice_expiry_delta_secs) {
-               long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr & ~1, invoice_expiry_delta_secs);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, int invoice_expiry_delta_secs, org.ldk.structs.Option_u16Z min_final_cltv_expiry_delta) {
+               long ret = bindings.create_invoice_from_channelmanager_with_description_hash(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
                Reference.reachabilityFence(channelmanager);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(description_hash);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(channelmanager);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -644,19 +1043,25 @@ public class UtilMethods {
         * This version 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_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, Sha256 description_hash, long duration_since_epoch, int invoice_expiry_delta_secs) {
-               long ret = bindings.create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr & ~1, duration_since_epoch, invoice_expiry_delta_secs);
+       public static Result_Bolt11InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_with_description_hash_and_duration_since_epoch(org.ldk.structs.ChannelManager channelmanager, org.ldk.structs.NodeSigner node_signer, org.ldk.structs.Logger logger, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, org.ldk.structs.Sha256 description_hash, 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_with_description_hash_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr, node_signer.ptr, logger.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs, min_final_cltv_expiry_delta.ptr);
                Reference.reachabilityFence(channelmanager);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(description_hash);
                Reference.reachabilityFence(duration_since_epoch);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(channelmanager);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }
 
@@ -665,19 +1070,52 @@ public class UtilMethods {
         * This version 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_InvoiceSignOrCreationErrorZ create_invoice_from_channelmanager_and_duration_since_epoch(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, java.lang.String description, long duration_since_epoch, int invoice_expiry_delta_secs) {
-               long ret = bindings.create_invoice_from_channelmanager_and_duration_since_epoch(channelmanager == null ? 0 : channelmanager.ptr & ~1, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs);
+       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, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.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);
                Reference.reachabilityFence(channelmanager);
-               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
                Reference.reachabilityFence(network);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(description);
                Reference.reachabilityFence(duration_since_epoch);
                Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * See [`create_invoice_from_channelmanager_and_duration_since_epoch`]
+        * This version allows for providing a custom [`PaymentHash`] for the invoice.
+        * This may be useful if you're building an on-chain swap or involving another protocol where
+        * 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, org.ldk.enums.Currency network, org.ldk.structs.Option_u64Z amt_msat, java.lang.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);
+               Reference.reachabilityFence(channelmanager);
+               Reference.reachabilityFence(node_signer);
+               Reference.reachabilityFence(logger);
+               Reference.reachabilityFence(network);
+               Reference.reachabilityFence(amt_msat);
+               Reference.reachabilityFence(description);
+               Reference.reachabilityFence(duration_since_epoch);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(payment_hash);
+               Reference.reachabilityFence(min_final_cltv_expiry_delta);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(channelmanager);
-               ret_hu_conv.ptrs_to.add(keys_manager);
+               Result_Bolt11InvoiceSignOrCreationErrorZ ret_hu_conv = Result_Bolt11InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(node_signer); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(amt_msat); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(min_final_cltv_expiry_delta); };
                return ret_hu_conv;
        }