@@ -56,6 +56,10 @@ use crate::ln::outbound_payment;
56
56
use crate :: ln:: outbound_payment:: { OutboundPayments , PaymentAttempts , PendingOutboundPayment , Retry } ;
57
57
use crate :: ln:: wire:: Encode ;
58
58
use 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 ;
59
63
use crate :: util:: config:: { UserConfig , ChannelConfig } ;
60
64
use crate :: util:: events:: { Event , EventHandler , EventsProvider , MessageSendEvent , MessageSendEventsProvider , ClosureReason , HTLCDestination } ;
61
65
use crate :: util:: events;
@@ -5318,6 +5322,36 @@ where
5318
5322
Ok ( payment_secret)
5319
5323
}
5320
5324
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
+
5321
5355
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
5322
5356
/// to pay us.
5323
5357
///
0 commit comments