Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve offer documentation #710

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,19 @@ pub enum OfferKind {
},
}

/// Information on a funds offer that can be claimed using LNURL-w.
/// Information on a funds offer that can be claimed
/// using [`LightningNode::request_offer_collection`].
#[derive(Debug)]
pub struct OfferInfo {
pub offer_kind: OfferKind,
/// Amount available for withdrawal
pub amount: Amount,
/// The lnurlw string that will be used to withdraw this offer. Can be empty if the offer isn't
/// available anymore (i.e `status` is [`OfferStatus::REFUNDED`])
pub lnurlw: Option<String>,
pub created_at: SystemTime,
/// The time this offer expires at. Can be empty if the offer isn't available anymore
/// (i.e `status` is [`OfferStatus::REFUNDED`]).
pub expires_at: Option<SystemTime>,
pub status: OfferStatus,
}
Expand Down Expand Up @@ -946,6 +951,10 @@ impl LightningNode {
/// The offer collection might be considered successful once
/// [`EventsCallback::payment_received()`] is called,
/// or the [`PaymentState`] of the respective payment becomes [`PaymentState::Succeeded`].
///
/// Parameters:
/// * `offer` - An offer that is still valid for collection. Must have its `lnurlw` field
/// filled in.
pub fn request_offer_collection(&self, offer: OfferInfo) -> Result<String> {
let lnurlw_data = match self.rt.handle().block_on(parse(
&offer
Expand Down
Loading