Skip to content

Commit b81931c

Browse files
committed
f - update OfferBuilder docs
1 parent 085b3fe commit b81931c

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
@@ -80,8 +80,9 @@ pub struct OfferBuilder {
8080
}
8181

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

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

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

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

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

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

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

151-
/// Sets a blinded path for the offer.
153+
/// Adds a blinded path to [`Offer::paths`].
152154
///
153155
/// Successive calls to this method will add another blinded path. Caller is responsible for not
154156
/// adding duplicate paths.
@@ -157,7 +159,8 @@ impl OfferBuilder {
157159
self
158160
}
159161

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

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

0 commit comments

Comments
 (0)