55// http://opensource.org/licenses/MIT>, at your option. You may not use this file except in
66// accordance with one or both of these licenses.
77
8- //! Holds a payment handler allowing to create [BIP 21] URIs with an on-chain, [BOLT 11], and [BOLT 12] payment
8+ //! Holds a payment handler allowing to create [BIP 21] URIs with on-chain, [BOLT 11], and [BOLT 12] payment
99//! options.
1010//!
11+ //! Also allows to send payments using these URIs as well as [BIP 353] HRNs.
12+ //!
1113//! [BIP 21]: https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki
14+ //! [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
1215//! [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md
1316//! [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md
1417use crate :: error:: Error ;
@@ -29,6 +32,12 @@ use bitcoin::{Amount, Txid};
2932use std:: sync:: Arc ;
3033use std:: vec:: IntoIter ;
3134
35+ use bitcoin_payment_instructions:: {
36+ amount:: Amount as BPIAmount , PaymentInstructions , PaymentMethod ,
37+ } ;
38+
39+ use crate :: types:: HRNResolver ;
40+
3241type Uri < ' a > = bip21:: Uri < ' a , NetworkChecked , Extras > ;
3342
3443#[ derive( Debug , Clone ) ]
@@ -40,26 +49,31 @@ struct Extras {
4049/// A payment handler allowing to create [BIP 21] URIs with an on-chain, [BOLT 11], and [BOLT 12] payment
4150/// option.
4251///
43- /// Should be retrieved by calling [`Node::unified_qr_payment`]
52+ /// Should be retrieved by calling [`Node::unified_payment`]
53+ ///
54+ /// This handler allows you to send payments to these URIs as well as [BIP 353] HRNs.
4455///
4556/// [BIP 21]: https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki
57+ /// [BIP 353]: https://github.com/bitcoin/bips/blob/master/bip-0353.mediawiki
4658/// [BOLT 11]: https://github.com/lightning/bolts/blob/master/11-payment-encoding.md
4759/// [BOLT 12]: https://github.com/lightning/bolts/blob/master/12-offer-encoding.md
48- /// [`Node::unified_qr_payment `]: crate::Node::unified_qr_payment
60+ /// [`Node::unified_payment `]: crate::Node::unified_payment
4961pub struct UnifiedPayment {
5062 onchain_payment : Arc < OnchainPayment > ,
5163 bolt11_invoice : Arc < Bolt11Payment > ,
5264 bolt12_payment : Arc < Bolt12Payment > ,
5365 config : Arc < Config > ,
5466 logger : Arc < Logger > ,
67+ hrn_resolver : Arc < HRNResolver > ,
5568}
5669
5770impl UnifiedPayment {
5871 pub ( crate ) fn new (
5972 onchain_payment : Arc < OnchainPayment > , bolt11_invoice : Arc < Bolt11Payment > ,
6073 bolt12_payment : Arc < Bolt12Payment > , config : Arc < Config > , logger : Arc < Logger > ,
74+ hrn_resolver : Arc < HRNResolver > ,
6175 ) -> Self {
62- Self { onchain_payment, bolt11_invoice, bolt12_payment, config, logger }
76+ Self { onchain_payment, bolt11_invoice, bolt12_payment, config, logger, hrn_resolver }
6377 }
6478
6579 /// Generates a URI with an on-chain address, [BOLT 11] invoice and [BOLT 12] offer.
0 commit comments