[Java] Update auto-generated Java structs
[ldk-java] / src / main / java / org / ldk / structs / UtilMethods.java
index 653c519d9021e6bb4845de3e35f49d19915041a7..4990ad25faeecf5a2ed0900e020a703c19e5f211 100644 (file)
@@ -34,6 +34,17 @@ public class UtilMethods {
                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
         */
@@ -83,6 +94,16 @@ public class UtilMethods {
                return ret;
        }
 
+       /**
+        * 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);
+               Reference.reachabilityFence(hrp_bytes);
+               Reference.reachabilityFence(data_without_signature);
+               return ret;
+       }
+
        /**
         * Read a MonitorEvent from a byte array, created by MonitorEvent_write
         */
@@ -103,7 +124,7 @@ public class UtilMethods {
                Reference.reachabilityFence(arg);
                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);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg); };
                return ret_hu_conv;
        }
 
@@ -111,7 +132,7 @@ public class UtilMethods {
         * Read a C2Tuple_BlockHashChannelManagerZ from a byte array, created by C2Tuple_BlockHashChannelManagerZ_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));
+               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, 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_fee_estimator);
@@ -122,13 +143,62 @@ public class UtilMethods {
                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); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(arg_keys_manager); };
+               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_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;
+       }
+
+       /**
+        * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment`], but no
+        * `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
+        * 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
+        */
+       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, min_value_msat.ptr, invoice_expiry_delta_secs, keys_manager == null ? 0 : keys_manager.ptr, current_time);
+               Reference.reachabilityFence(keys);
+               Reference.reachabilityFence(min_value_msat);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(current_time);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_C2Tuple_PaymentHashPaymentSecretZNoneZ ret_hu_conv = Result_C2Tuple_PaymentHashPaymentSecretZNoneZ.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(keys_manager); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Equivalent to [`crate::ln::channelmanager::ChannelManager::create_inbound_payment_for_hash`],
+        * but no `ChannelManager` is required. Useful for generating invoices for [phantom node payments]
+        * without a `ChannelManager`.
+        * 
+        * See [`create`] for information on the `keys` and `current_time` parameters.
+        * 
+        * [phantom node payments]: crate::chain::keysinterface::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, min_value_msat.ptr, InternalUtils.check_arr_len(payment_hash, 32), invoice_expiry_delta_secs, current_time);
+               Reference.reachabilityFence(keys);
+               Reference.reachabilityFence(min_value_msat);
+               Reference.reachabilityFence(payment_hash);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
+               Reference.reachabilityFence(current_time);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_PaymentSecretNoneZ ret_hu_conv = Result_PaymentSecretNoneZ.constr_from_ptr(ret);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys); };
                return ret_hu_conv;
        }
 
@@ -164,7 +234,7 @@ 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);
+               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);
@@ -266,12 +336,10 @@ public class UtilMethods {
         * 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);
+               byte[] ret = bindings.get_htlc_redeemscript(htlc == null ? 0 : htlc.ptr, opt_anchors, keys == null ? 0 : keys.ptr);
                Reference.reachabilityFence(htlc);
                Reference.reachabilityFence(opt_anchors);
                Reference.reachabilityFence(keys);
-               // this.ptrs_to.add(htlc);
-               // this.ptrs_to.add(keys);
                return ret;
        }
 
@@ -296,7 +364,7 @@ public class UtilMethods {
         * 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));
+               byte[] ret = bindings.build_htlc_transaction(InternalUtils.check_arr_len(commitment_txid, 32), feerate_per_kw, contest_delay, htlc == null ? 0 : htlc.ptr, opt_anchors, InternalUtils.check_arr_len(broadcaster_delayed_payment_key, 33), InternalUtils.check_arr_len(revocation_key, 33));
                Reference.reachabilityFence(commitment_txid);
                Reference.reachabilityFence(feerate_per_kw);
                Reference.reachabilityFence(contest_delay);
@@ -304,7 +372,6 @@ public class UtilMethods {
                Reference.reachabilityFence(opt_anchors);
                Reference.reachabilityFence(broadcaster_delayed_payment_key);
                Reference.reachabilityFence(revocation_key);
-               // this.ptrs_to.add(htlc);
                return ret;
        }
 
@@ -358,8 +425,8 @@ public class UtilMethods {
         * Private routing paths between a public node and the target may be included in `params.payee`.
         * 
         * 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 our local
-        * channels from [`NetworkGraph`] will be ignored, and only those in `first_hops` will be used.
+        * from [`ChannelManager::list_usable_channels`]. If it is filled in, the view of these channels
+        * from `network_graph` will be ignored, and only those in `first_hops` will be used.
         * 
         * The fees on channels from us to the next hop are ignored as they are assumed to all be equal.
         * However, the enabled/disabled bit on such channels as well as the `htlc_minimum_msat` /
@@ -378,38 +445,174 @@ public class UtilMethods {
         * 
         * [`ChannelManager::list_usable_channels`]: crate::ln::channelmanager::ChannelManager::list_usable_channels
         * [`Event::PaymentPathFailed`]: crate::util::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 params, NetworkGraph network, @Nullable ChannelDetails[] first_hops, Logger logger, Score scorer) {
-               long ret = bindings.find_route(InternalUtils.check_arr_len(our_node_pubkey, 33), params == null ? 0 : params.ptr & ~1, network == null ? 0 : network.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);
+       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, 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 == null ? 0 : logger.ptr, scorer == null ? 0 : scorer.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
                Reference.reachabilityFence(our_node_pubkey);
-               Reference.reachabilityFence(params);
-               Reference.reachabilityFence(network);
+               Reference.reachabilityFence(route_params);
+               Reference.reachabilityFence(network_graph);
                Reference.reachabilityFence(first_hops);
                Reference.reachabilityFence(logger);
                Reference.reachabilityFence(scorer);
+               Reference.reachabilityFence(random_seed_bytes);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_RouteLightningErrorZ ret_hu_conv = Result_RouteLightningErrorZ.constr_from_ptr(ret);
+               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); };
+               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); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * Construct a route from us (payer) to the target node (payee) via the given hops (which should
+        * exclude the payer, but include the payee). This may be useful, e.g., for probing the chosen path.
+        * 
+        * 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, network_graph == null ? 0 : network_graph.ptr, logger == null ? 0 : logger.ptr, InternalUtils.check_arr_len(random_seed_bytes, 32));
+               Reference.reachabilityFence(our_node_pubkey);
+               Reference.reachabilityFence(hops);
+               Reference.reachabilityFence(route_params);
+               Reference.reachabilityFence(network_graph);
+               Reference.reachabilityFence(logger);
+               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(params);
-               ret_hu_conv.ptrs_to.add(network);
-               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 (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(logger); };
+               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.
+        * 
+        * `phantom_route_hints` parameter:
+        * Contains channel info for all nodes participating in the phantom invoice
+        * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
+        * 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
+        * 
+        * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+        * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+        * If `None` is provided for `payment_hash`, then one will be created.
+        * 
+        * `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
+        * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
+        * requirement).
+        * 
+        * [`PhantomKeysManager`]: lightning::chain::keysinterface::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
+        */
+       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).toArray() : null, keys_manager == null ? 0 : keys_manager.ptr, network);
+               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(network);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               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(keys_manager); };
+               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.
+        * 
+        * `phantom_route_hints` parameter:
+        * Contains channel info for all nodes participating in the phantom invoice
+        * Entries are retrieved from a call to [`ChannelManager::get_phantom_route_hints`] on each
+        * 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
+        * 
+        * `description_hash` is a SHA-256 hash of the description text
+        * 
+        * `payment_hash` can be specified if you have a specific need for a custom payment hash (see the difference
+        * between [`ChannelManager::create_inbound_payment`] and [`ChannelManager::create_inbound_payment_for_hash`]).
+        * If `None` is provided for `payment_hash`, then one will be created.
+        * 
+        * `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
+        * invoices in its `sign_invoice` implementation ([`PhantomKeysManager`] satisfies this
+        * requirement).
+        * 
+        * [`PhantomKeysManager`]: lightning::chain::keysinterface::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
+        */
+       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, 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, keys_manager == null ? 0 : keys_manager.ptr, network);
+               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(network);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.constr_from_ptr(ret);
+               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(keys_manager); };
                return ret_hu_conv;
        }
 
        /**
-        * Writes the provided `ChannelManager` to the path provided at `FilesystemPersister`
-        * initialization, within a file called \"manager\".
+        * Utility to construct an invoice. Generally, unless you want to do something like a custom
+        * cltv_expiry, this is what you should be using to create an invoice. The reason being, this
+        * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
+        * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
+        * that the payment secret is valid when the invoice is paid.
+        * 
+        * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+        * in excess of the current time.
         */
-       public static Result_NoneErrorZ FilesystemPersister_persist_manager(java.lang.String data_dir, ChannelManager manager) {
-               long ret = bindings.FilesystemPersister_persist_manager(data_dir, manager == null ? 0 : manager.ptr & ~1);
-               Reference.reachabilityFence(data_dir);
-               Reference.reachabilityFence(manager);
+       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, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description, invoice_expiry_delta_secs);
+               Reference.reachabilityFence(channelmanager);
+               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(network);
+               Reference.reachabilityFence(amt_msat);
+               Reference.reachabilityFence(description);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
                if (ret >= 0 && ret <= 4096) { return null; }
-               Result_NoneErrorZ ret_hu_conv = Result_NoneErrorZ.constr_from_ptr(ret);
-               ret_hu_conv.ptrs_to.add(manager);
+               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.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(keys_manager); };
                return ret_hu_conv;
        }
 
@@ -419,18 +622,67 @@ public class UtilMethods {
         * method stores the invoice's payment secret and preimage in `ChannelManager`, so (a) the user
         * doesn't have to store preimage/payment secret information and (b) `ChannelManager` can verify
         * that the payment secret is valid when the invoice is paid.
+        * Use this variant if you want to pass the `description_hash` to the invoice.
+        * 
+        * `invoice_expiry_delta_secs` describes the number of seconds that the invoice is valid for
+        * in excess of the current time.
+        */
+       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, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, invoice_expiry_delta_secs);
+               Reference.reachabilityFence(channelmanager);
+               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(network);
+               Reference.reachabilityFence(amt_msat);
+               Reference.reachabilityFence(description_hash);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.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(keys_manager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * See [`create_invoice_from_channelmanager_with_description_hash`]
+        * 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, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description_hash == null ? 0 : description_hash.ptr, duration_since_epoch, invoice_expiry_delta_secs);
+               Reference.reachabilityFence(channelmanager);
+               Reference.reachabilityFence(keys_manager);
+               Reference.reachabilityFence(network);
+               Reference.reachabilityFence(amt_msat);
+               Reference.reachabilityFence(description_hash);
+               Reference.reachabilityFence(duration_since_epoch);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
+               if (ret >= 0 && ret <= 4096) { return null; }
+               Result_InvoiceSignOrCreationErrorZ ret_hu_conv = Result_InvoiceSignOrCreationErrorZ.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(keys_manager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(description_hash); };
+               return ret_hu_conv;
+       }
+
+       /**
+        * See [`create_invoice_from_channelmanager`]
+        * 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(ChannelManager channelmanager, KeysInterface keys_manager, org.ldk.enums.Currency network, Option_u64Z amt_msat, java.lang.String description) {
-               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);
+       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, keys_manager == null ? 0 : keys_manager.ptr, network, amt_msat.ptr, description, duration_since_epoch, invoice_expiry_delta_secs);
                Reference.reachabilityFence(channelmanager);
                Reference.reachabilityFence(keys_manager);
                Reference.reachabilityFence(network);
                Reference.reachabilityFence(amt_msat);
                Reference.reachabilityFence(description);
+               Reference.reachabilityFence(duration_since_epoch);
+               Reference.reachabilityFence(invoice_expiry_delta_secs);
                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);
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(channelmanager); };
+               if (ret_hu_conv != null) { ret_hu_conv.ptrs_to.add(keys_manager); };
                return ret_hu_conv;
        }