@@ -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 } ;
@@ -873,6 +875,16 @@ impl PaymentParameters {
873
875
. with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
874
876
}
875
877
878
+ #[ cfg( async_payments) ]
879
+ /// Creates parameters for paying to a blinded payee from the provided invoice. Sets
880
+ /// [`Payee::Blinded::route_hints`], [`Payee::Blinded::features`], and
881
+ /// [`PaymentParameters::expiry_time`].
882
+ pub fn from_static_invoice ( invoice : & StaticInvoice ) -> Self {
883
+ Self :: blinded ( invoice. payment_paths ( ) . to_vec ( ) )
884
+ . with_bolt12_features ( invoice. invoice_features ( ) . clone ( ) ) . unwrap ( )
885
+ . with_expiry_time ( invoice. created_at ( ) . as_secs ( ) . saturating_add ( invoice. relative_expiry ( ) . as_secs ( ) ) )
886
+ }
887
+
876
888
/// Creates parameters for paying to a blinded payee from the provided blinded route hints.
877
889
pub fn blinded ( blinded_route_hints : Vec < ( BlindedPayInfo , BlindedPath ) > ) -> Self {
878
890
Self {
0 commit comments