@@ -56,6 +56,10 @@ use crate::ln::outbound_payment;
5656use crate :: ln:: outbound_payment:: { OutboundPayments , PaymentAttempts , PendingOutboundPayment , Retry } ;
5757use crate :: ln:: wire:: Encode ;
5858use crate :: chain:: keysinterface:: { EntropySource , KeysManager , NodeSigner , Recipient , SignerProvider , ChannelSigner } ;
59+ use crate :: offers:: offer:: OfferBuilder ;
60+ use crate :: offers:: parse:: SemanticError ;
61+ use crate :: offers:: refund:: RefundBuilder ;
62+ use crate :: offers:: signer:: DerivedPubkey ;
5963use crate :: util:: config:: { UserConfig , ChannelConfig } ;
6064use crate :: util:: events:: { Event , EventHandler , EventsProvider , MessageSendEvent , MessageSendEventsProvider , ClosureReason , HTLCDestination } ;
6165use crate :: util:: events;
@@ -5318,6 +5322,36 @@ where
53185322 Ok ( payment_secret)
53195323 }
53205324
5325+ /// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
5326+ /// [`OnionMessenger`] when handling [`InvoiceRequest`] messages for the offer.
5327+ ///
5328+ /// [`Offer`]: crate::offers::offer::Offer
5329+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
5330+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
5331+ pub fn create_offer_builder ( & self , description : String ) -> OfferBuilder {
5332+ let nonce = inbound_payment:: Nonce :: from_entropy_source ( & * self . entropy_source ) ;
5333+ let signing_pubkey = DerivedPubkey :: new ( & self . inbound_payment_key , nonce) ;
5334+
5335+ // TODO: Set blinded paths
5336+ OfferBuilder :: deriving_signing_pubkey ( description, signing_pubkey)
5337+ }
5338+
5339+ /// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
5340+ /// [`OnionMessenger`] when handling [`Invoice`] messages for the refund.
5341+ ///
5342+ /// [`Refund`]: crate::offers::refund::Refund
5343+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
5344+ /// [`Invoice`]: crate::offers::invoice::Invoice
5345+ pub fn create_refund_builder (
5346+ & self , description : String , amount_msats : u64
5347+ ) -> Result < RefundBuilder , SemanticError > {
5348+ let nonce = inbound_payment:: Nonce :: from_entropy_source ( & * self . entropy_source ) ;
5349+ let payer_id = DerivedPubkey :: new ( & self . inbound_payment_key , nonce) ;
5350+
5351+ // TODO: Set blinded paths
5352+ RefundBuilder :: deriving_payer_id ( description, payer_id, amount_msats)
5353+ }
5354+
53215355 /// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
53225356 /// to pay us.
53235357 ///
0 commit comments