@@ -20,6 +20,8 @@ use crate::ln::channelmanager::{PaymentId, MIN_FINAL_CLTV_EXPIRY_DELTA, Recipien
20
20
use crate :: ln:: features:: { BlindedHopFeatures , Bolt11InvoiceFeatures , Bolt12InvoiceFeatures , ChannelFeatures , NodeFeatures } ;
21
21
use crate :: ln:: msgs:: { DecodeError , ErrorAction , LightningError , MAX_VALUE_MSAT } ;
22
22
use crate :: ln:: onion_utils;
23
+ #[ cfg( async_payments) ]
24
+ use crate :: offers:: static_invoice:: StaticInvoice ;
23
25
use crate :: offers:: invoice:: Bolt12Invoice ;
24
26
use crate :: onion_message:: messenger:: { DefaultMessageRouter , Destination , MessageRouter , OnionMessagePath } ;
25
27
use crate :: routing:: gossip:: { DirectedChannelInfo , EffectiveCapacity , ReadOnlyNetworkGraph , NetworkGraph , NodeId } ;
@@ -877,6 +879,16 @@ impl PaymentParameters {
877
879
. with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
878
880
}
879
881
882
+ /// Creates parameters for paying to a blinded payee from the provided invoice. Sets
883
+ /// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and
884
+ /// [`PaymentParameters::expiry_time`].
885
+ #[ cfg( async_payments) ]
886
+ pub fn from_static_invoice ( invoice : & StaticInvoice ) -> Self {
887
+ Self :: blinded ( invoice. payment_paths ( ) . to_vec ( ) )
888
+ . with_bolt12_features ( invoice. invoice_features ( ) . clone ( ) ) . unwrap ( )
889
+ . with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
890
+ }
891
+
880
892
/// Creates parameters for paying to a blinded payee from the provided blinded route hints.
881
893
pub fn blinded ( blinded_route_hints : Vec < BlindedPaymentPath > ) -> Self {
882
894
Self {
0 commit comments