Skip to content

Commit 5cfa419

Browse files
committed
f - update OfferBuilder docs
1 parent df5e5a1 commit 5cfa419

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

lightning/src/offers/offer.rs

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,9 @@ pub struct OfferBuilder {
8181
}
8282

8383
impl OfferBuilder {
84-
/// Creates a new builder for an offer with the given description, using the given pubkey for
85-
/// signing invoices. The associated secret key must be remembered while the offer is valid.
84+
/// Creates a new builder for an offer setting the [`Offer::description`] and using the
85+
/// [`Offer::signing_pubkey`] for signing invoices. The associated secret key must be remembered
86+
/// while the offer is valid.
8687
///
8788
/// Use a different pubkey per offer to avoid correlating offers.
8889
pub fn new(description: String, signing_pubkey: PublicKey) -> Self {
@@ -94,8 +95,8 @@ impl OfferBuilder {
9495
OfferBuilder { offer }
9596
}
9697

97-
/// Sets a chain hash of the given [`Network`] for the offer. If not called,
98-
/// [`Network::Bitcoin`] is assumed.
98+
/// Adds the chain hash of the given [`Network`] to [`Offer::chains`]. If not called,
99+
/// the chain hash of [`Network::Bitcoin`] is assumed to be the only one supported.
99100
///
100101
/// Successive calls to this method will add another chain hash.
101102
pub fn chain(mut self, network: Network) -> Self {
@@ -108,23 +109,23 @@ impl OfferBuilder {
108109
self
109110
}
110111

111-
/// Sets the metadata for the offer. Useful for authentication and validating fields.
112+
/// Sets the [`Offer::metadata`].
112113
///
113114
/// Successive calls to this method will override the previous setting.
114115
pub fn metadata(mut self, metadata: Vec<u8>) -> Self {
115116
self.offer.metadata = Some(metadata);
116117
self
117118
}
118119

119-
/// Sets the amount for the offer.
120+
/// Sets the [`Offer::amount`].
120121
///
121122
/// Successive calls to this method will override the previous setting.
122123
pub fn amount(mut self, amount: Amount) -> Self {
123124
self.offer.amount = Some(amount);
124125
self
125126
}
126127

127-
/// Sets the features for the offer.
128+
/// Sets the [`Offer::features`].
128129
///
129130
/// Successive calls to this method will override the previous setting.
130131
#[cfg(test)]
@@ -133,23 +134,24 @@ impl OfferBuilder {
133134
self
134135
}
135136

136-
/// Sets the absolute expiry for the offer as seconds since the Unix epoch.
137+
/// Sets the [`Offer::absolute_expiry`] as seconds since the Unix epoch. Any expiry that has
138+
/// already passed is valid and can be checked for using [`Offer::is_expired`].
137139
///
138140
/// Successive calls to this method will override the previous setting.
139141
pub fn absolute_expiry(mut self, absolute_expiry: Duration) -> Self {
140142
self.offer.absolute_expiry = Some(absolute_expiry);
141143
self
142144
}
143145

144-
/// Sets the issuer for the offer.
146+
/// Sets the [`Offer::issuer`].
145147
///
146148
/// Successive calls to this method will override the previous setting.
147149
pub fn issuer(mut self, issuer: String) -> Self {
148150
self.offer.issuer = Some(issuer);
149151
self
150152
}
151153

152-
/// Sets a blinded path for the offer.
154+
/// Adds a blinded path to [`Offer::paths`].
153155
///
154156
/// Successive calls to this method will add another blinded path. Caller is responsible for not
155157
/// adding duplicate paths.
@@ -158,7 +160,8 @@ impl OfferBuilder {
158160
self
159161
}
160162

161-
/// Sets a fixed quantity of items for the offer. If not set, `1` is assumed.
163+
/// Sets a fixed quantity of items for [`Offer::quantity_min`] and [`Offer::quantity_max`]. If
164+
/// not set, `1` is assumed.
162165
///
163166
/// Successive calls to this method or [`quantity_range`] will override the previous setting.
164167
///
@@ -170,7 +173,8 @@ impl OfferBuilder {
170173
self
171174
}
172175

173-
/// Sets a quantity range of items for the offer. If not set, `1` is assumed.
176+
/// Sets a quantity range of items for [`Offer::quantity_min`] and [`Offer::quantity_max`]. If
177+
/// not set, `1` is assumed.
174178
///
175179
/// Successive calls to this method or [`quantity_fixed`] will override the previous setting.
176180
///

0 commit comments

Comments
 (0)