@@ -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:: { BlindedPayInfo , Bolt12Invoice } ;
24
26
use crate :: onion_message:: messenger:: { DefaultMessageRouter , Destination , MessageRouter , OnionMessagePath } ;
25
27
use crate :: routing:: gossip:: { DirectedChannelInfo , EffectiveCapacity , ReadOnlyNetworkGraph , NetworkGraph , NodeId , RoutingFees } ;
@@ -858,6 +860,16 @@ impl PaymentParameters {
858
860
. with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
859
861
}
860
862
863
+ #[ cfg( async_payments) ]
864
+ /// Creates parameters for paying to a blinded payee from the provided invoice. Sets
865
+ /// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and
866
+ /// [`PaymentParameters::expiry_time`].
867
+ pub fn from_static_invoice ( invoice : & StaticInvoice ) -> Self {
868
+ Self :: blinded ( invoice. payment_paths ( ) . to_vec ( ) )
869
+ . with_bolt12_features ( invoice. invoice_features ( ) . clone ( ) ) . unwrap ( )
870
+ . with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
871
+ }
872
+
861
873
/// Creates parameters for paying to a blinded payee from the provided blinded route hints.
862
874
pub fn blinded ( blinded_route_hints : Vec < ( BlindedPayInfo , BlindedPath ) > ) -> Self {
863
875
Self {
0 commit comments