@@ -10318,9 +10318,23 @@ where
1031810318 #[cfg(c_bindings)]
1031910319 create_refund_builder!(self, RefundMaybeWithDerivedMetadataBuilder);
1032010320
10321+ /// Retrieve our cached [`Offer`] for receiving async payments as an often-offline recipient. Will
10322+ /// only be set if [`UserConfig::paths_to_static_invoice_server`] is set and we succeeded in
10323+ /// interactively building a [`StaticInvoice`] with the static invoice server.
10324+ #[cfg(async_payments)]
10325+ pub fn get_cached_async_receive_offer(&self) -> Option<Offer> {
10326+ let mut offer_cache = self.async_receive_offer_cache.lock().unwrap();
10327+ offer_cache.check_expire_offer(self.duration_since_epoch());
10328+
10329+ offer_cache.offer.clone()
10330+ }
10331+
1032110332 /// Create an offer for receiving async payments as an often-offline recipient.
1032210333 ///
10323- /// Because we may be offline when the payer attempts to request an invoice, you MUST:
10334+ /// Instead of using this method, prefer to set [`UserConfig::paths_to_static_invoice_server`] and
10335+ /// retrieve the automatically built offer via [`Self::get_cached_async_receive_offer`].
10336+ ///
10337+ /// If you want to build the [`StaticInvoice`] manually using this method instead, you MUST:
1032410338 /// 1. Provide at least 1 [`BlindedMessagePath`] terminating at an always-online node that will
1032510339 /// serve the [`StaticInvoice`] created from this offer on our behalf.
1032610340 /// 2. Use [`Self::create_static_invoice_builder`] to create a [`StaticInvoice`] from this
@@ -10354,6 +10368,10 @@ where
1035410368 /// Creates a [`StaticInvoiceBuilder`] from the corresponding [`Offer`] and [`Nonce`] that were
1035510369 /// created via [`Self::create_async_receive_offer_builder`]. If `relative_expiry` is unset, the
1035610370 /// invoice's expiry will default to [`STATIC_INVOICE_DEFAULT_RELATIVE_EXPIRY`].
10371+ ///
10372+ /// Instead of using this method to manually build the invoice, prefer to set
10373+ /// [`UserConfig::paths_to_static_invoice_server`] and retrieve the automatically built offer via
10374+ /// [`Self::get_cached_async_receive_offer`].
1035710375 #[cfg(async_payments)]
1035810376 pub fn create_static_invoice_builder<'a>(
1035910377 &self, offer: &'a Offer, offer_nonce: Nonce, relative_expiry: Option<Duration>
0 commit comments