@@ -18,7 +18,7 @@ use crate::types::{ChannelManager, PaymentStore};
1818
1919use lightning:: blinded_path:: message:: BlindedMessagePath ;
2020use lightning:: ln:: channelmanager:: { OptionalOfferPaymentParams , PaymentId , Retry } ;
21- use lightning:: offers:: offer:: { Amount , Offer as LdkOffer , Quantity } ;
21+ use lightning:: offers:: offer:: { Amount , Offer as LdkOffer , OfferFromHrn , Quantity } ;
2222use lightning:: offers:: parse:: Bolt12SemanticError ;
2323use lightning:: routing:: router:: RouteParametersConfig ;
2424
@@ -47,6 +47,11 @@ type Refund = lightning::offers::refund::Refund;
4747#[ cfg( feature = "uniffi" ) ]
4848type Refund = Arc < crate :: ffi:: Refund > ;
4949
50+ #[ cfg( not( feature = "uniffi" ) ) ]
51+ type HumanReadableName = lightning:: onion_message:: dns_resolution:: HumanReadableName ;
52+ #[ cfg( feature = "uniffi" ) ]
53+ type HumanReadableName = Arc < crate :: ffi:: HumanReadableName > ;
54+
5055/// A payment handler allowing to create and pay [BOLT 12] offers and refunds.
5156///
5257/// Should be retrieved by calling [`Node::bolt12_payment`].
@@ -184,6 +189,7 @@ impl Bolt12Payment {
184189 /// response.
185190 pub fn send_using_amount (
186191 & self , offer : & Offer , amount_msat : u64 , quantity : Option < u64 > , payer_note : Option < String > ,
192+ hrn : Option < HumanReadableName > ,
187193 ) -> Result < PaymentId , Error > {
188194 if !* self . is_running . read ( ) . unwrap ( ) {
189195 return Err ( Error :: NotRunning ) ;
@@ -218,7 +224,11 @@ impl Bolt12Payment {
218224 retry_strategy,
219225 route_params_config,
220226 } ;
221- let res = if let Some ( quantity) = quantity {
227+ let res = if let Some ( hrn) = hrn {
228+ let hrn = maybe_deref ( & hrn) ;
229+ let offer = OfferFromHrn { offer : offer. clone ( ) , hrn : * hrn } ;
230+ self . channel_manager . pay_for_offer_from_hrn ( & offer, amount_msat, payment_id, params)
231+ } else if let Some ( quantity) = quantity {
222232 self . channel_manager . pay_for_offer_with_quantity (
223233 & offer,
224234 Some ( amount_msat) ,
0 commit comments