@@ -54,6 +54,9 @@ use crate::ln::outbound_payment;
5454use crate :: ln:: outbound_payment:: { OutboundPayments , PaymentAttempts , PendingOutboundPayment } ;
5555use crate :: ln:: wire:: Encode ;
5656use crate :: chain:: keysinterface:: { EntropySource , KeysManager , NodeSigner , Recipient , SignerProvider , ChannelSigner , WriteableEcdsaChannelSigner } ;
57+ use crate :: offers:: offer:: OfferBuilder ;
58+ use crate :: offers:: parse:: SemanticError ;
59+ use crate :: offers:: refund:: RefundBuilder ;
5760use crate :: util:: config:: { UserConfig , ChannelConfig } ;
5861use crate :: util:: events:: { Event , EventHandler , EventsProvider , MessageSendEvent , MessageSendEventsProvider , ClosureReason , HTLCDestination } ;
5962use crate :: util:: events;
@@ -5427,6 +5430,38 @@ where
54275430 Ok ( payment_secret)
54285431 }
54295432
5433+ /// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
5434+ /// [`OnionMessenger`] when handling [`InvoiceRequest`] messages for the offer.
5435+ ///
5436+ /// [`Offer`]: crate::offers::offer::Offer
5437+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
5438+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
5439+ pub fn create_offer_builder ( & self , description : String ) -> OfferBuilder {
5440+ let node_id = self . get_our_node_id ( ) ;
5441+ let expanded_key = & self . inbound_payment_key ;
5442+ let nonce = inbound_payment:: Nonce :: from_entropy_source ( & * self . entropy_source ) ;
5443+
5444+ // TODO: Set blinded paths
5445+ OfferBuilder :: deriving_signing_pubkey ( description, node_id, expanded_key, nonce)
5446+ }
5447+
5448+ /// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
5449+ /// [`OnionMessenger`] when handling [`Invoice`] messages for the refund.
5450+ ///
5451+ /// [`Refund`]: crate::offers::refund::Refund
5452+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
5453+ /// [`Invoice`]: crate::offers::invoice::Invoice
5454+ pub fn create_refund_builder (
5455+ & self , description : String , amount_msats : u64
5456+ ) -> Result < RefundBuilder , SemanticError > {
5457+ let node_id = self . get_our_node_id ( ) ;
5458+ let expanded_key = & self . inbound_payment_key ;
5459+ let nonce = inbound_payment:: Nonce :: from_entropy_source ( & * self . entropy_source ) ;
5460+
5461+ // TODO: Set blinded paths
5462+ RefundBuilder :: deriving_payer_id ( description, node_id, expanded_key, nonce, amount_msats)
5463+ }
5464+
54305465 /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
54315466 /// to pay us.
54325467 ///
0 commit comments