From 51cff95c06f3f73e785be1023a7348b7771a5bba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Granh=C3=A3o?= Date: Fri, 20 Oct 2023 14:30:42 +0100 Subject: [PATCH] Improve offer documentation --- src/lib.rs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index a6ec569d..860d7f2c 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -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, 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, pub status: OfferStatus, } @@ -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 { let lnurlw_data = match self.rt.handle().block_on(parse( &offer