+ /**
+ * 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.
+ * Use this variant if you want to pass the `description_hash` to the invoice.
+ */
+ 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) {
+ 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);
+ Reference.reachabilityFence(channelmanager);
+ Reference.reachabilityFence(keys_manager);
+ Reference.reachabilityFence(network);
+ Reference.reachabilityFence(amt_msat);
+ Reference.reachabilityFence(description_hash);
+ 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);
+ 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) {
+ 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);
+ Reference.reachabilityFence(channelmanager);
+ Reference.reachabilityFence(keys_manager);
+ Reference.reachabilityFence(network);
+ Reference.reachabilityFence(amt_msat);
+ Reference.reachabilityFence(description_hash);
+ 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(channelmanager);
+ ret_hu_conv.ptrs_to.add(keys_manager);
+ return ret_hu_conv;
+ }
+