@@ -57,8 +57,11 @@ use crate::ln::outbound_payment::{OutboundPayments, PaymentAttempts, PendingOutb
57
57
use crate :: ln:: wire:: Encode ;
58
58
use crate :: offers:: invoice:: { DEFAULT_RELATIVE_EXPIRY , DerivedSigningPubkey , InvoiceBuilder } ;
59
59
use crate :: offers:: invoice_error:: InvoiceError ;
60
+ use crate :: offers:: invoice_request:: { DerivedPayerId , InvoiceRequestBuilder } ;
60
61
use crate :: offers:: merkle:: SignError ;
62
+ use crate :: offers:: offer:: { DerivedMetadata , Offer , OfferBuilder } ;
61
63
use crate :: offers:: parse:: SemanticError ;
64
+ use crate :: offers:: refund:: RefundBuilder ;
62
65
use crate :: onion_message:: { OffersMessage , OffersMessageHandler } ;
63
66
use crate :: sign:: { EntropySource , KeysManager , NodeSigner , Recipient , SignerProvider , ChannelSigner , WriteableEcdsaChannelSigner } ;
64
67
use crate :: util:: config:: { UserConfig , ChannelConfig , ChannelConfigUpdate } ;
@@ -6080,6 +6083,60 @@ where
6080
6083
}
6081
6084
}
6082
6085
6086
+ /// Creates an [`OfferBuilder`] such that the [`Offer`] it builds is recognized by the
6087
+ /// [`OnionMessenger`] when handling [`InvoiceRequest`] messages for the offer.
6088
+ ///
6089
+ /// [`Offer`]: crate::offers::offer::Offer
6090
+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
6091
+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
6092
+ pub fn create_offer_builder (
6093
+ & self , description : String
6094
+ ) -> OfferBuilder < DerivedMetadata , secp256k1:: All > {
6095
+ let node_id = self . get_our_node_id ( ) ;
6096
+ let expanded_key = & self . inbound_payment_key ;
6097
+ let entropy = & * self . entropy_source ;
6098
+ let secp_ctx = & self . secp_ctx ;
6099
+
6100
+ // TODO: Set blinded paths
6101
+ OfferBuilder :: deriving_signing_pubkey ( description, node_id, expanded_key, entropy, secp_ctx)
6102
+ }
6103
+
6104
+ /// Creates a [`RefundBuilder`] such that the [`Refund`] it builds is recognized by the
6105
+ /// [`OnionMessenger`] when handling [`Invoice`] messages for the refund.
6106
+ ///
6107
+ /// [`Refund`]: crate::offers::refund::Refund
6108
+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
6109
+ /// [`Invoice`]: crate::offers::invoice::Invoice
6110
+ pub fn create_refund_builder (
6111
+ & self , description : String , amount_msats : u64
6112
+ ) -> Result < RefundBuilder < secp256k1:: All > , SemanticError > {
6113
+ let node_id = self . get_our_node_id ( ) ;
6114
+ let expanded_key = & self . inbound_payment_key ;
6115
+ let entropy = & * self . entropy_source ;
6116
+ let secp_ctx = & self . secp_ctx ;
6117
+
6118
+ // TODO: Set blinded paths
6119
+ RefundBuilder :: deriving_payer_id (
6120
+ description, node_id, expanded_key, entropy, secp_ctx, amount_msats
6121
+ )
6122
+ }
6123
+
6124
+ /// Creates an [`InvoiceRequestBuilder`] such that the [`InvoiceRequest`] it builds is
6125
+ /// recognized by the [`OnionMessenger`] when handling [`Invoice`] messages for the request.
6126
+ ///
6127
+ /// [`OnionMessenger`]: crate::onion_message::OnionMessenger
6128
+ /// [`InvoiceRequest`]: crate::offers::invoice_request::InvoiceRequest
6129
+ /// [`Invoice`]: crate::offers::invoice::Invoice
6130
+ pub fn create_invoice_request_builder < ' a , ' b > (
6131
+ & ' b self , offer : & ' a Offer
6132
+ ) -> Result < InvoiceRequestBuilder < ' a , ' b , DerivedPayerId , secp256k1:: All > , SemanticError > {
6133
+ let expanded_key = & self . inbound_payment_key ;
6134
+ let entropy = & * self . entropy_source ;
6135
+ let secp_ctx = & self . secp_ctx ;
6136
+
6137
+ offer. request_invoice_deriving_payer_id ( expanded_key, entropy, secp_ctx)
6138
+ }
6139
+
6083
6140
/// Gets a payment secret and payment hash for use in an invoice given to a third party wishing
6084
6141
/// to pay us.
6085
6142
///
0 commit comments