+/// The chains that may be used when paying a requested invoice.
+///
+/// From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
+///
+/// [`Offer::chains`]: crate::offers::offer::Offer::chains
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_offer_chains(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_chains();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) };
+ local_ret
+}
+
+/// The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
+/// invoice originated from an offer.
+///
+/// From [`InvoiceRequest::chain`] or [`Refund::chain`].
+///
+/// [`offer_chains`]: Self::offer_chains
+/// [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_chain(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
+ crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
+}
+
+/// Opaque bytes set by the originating [`Offer`].
+///
+/// From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
+/// if the [`Offer`] did not set it.
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_metadata(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_CVec_u8ZZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) };
+ local_ret
+}
+
+/// The minimum amount required for a successful payment of a single item.
+///
+/// From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
+/// the [`Offer`] did not set it.
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::amount`]: crate::offers::offer::Offer::amount
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_amount(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::offers::offer::Amount {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
+ let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+/// Features pertaining to the originating [`Offer`].
+///
+/// From [`Offer::offer_features`]; `None` if the invoice was created in response to a
+/// [`Refund`].
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_offer_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::OfferFeatures {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
+ let mut local_ret = crate::lightning::ln::features::OfferFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::OfferFeatures<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+/// A complete description of the purpose of the originating offer or refund.
+///
+/// From [`Offer::description`] or [`Refund::description`].
+///
+/// [`Offer::description`]: crate::offers::offer::Offer::description
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_description(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
+ crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// Duration since the Unix epoch when an invoice should no longer be requested.
+///
+/// From [`Offer::absolute_expiry`] or [`Refund::absolute_expiry`].
+///
+/// [`Offer::absolute_expiry`]: crate::offers::offer::Offer::absolute_expiry
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_absolute_expiry(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_u64Z {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap().as_secs() }) };
+ local_ret
+}
+
+/// The issuer of the offer or refund.
+///
+/// From [`Offer::issuer`] or [`Refund::issuer`].
+///
+/// [`Offer::issuer`]: crate::offers::offer::Offer::issuer
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_issuer(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
+ let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+
+/// Paths to the recipient originating from publicly reachable nodes.
+///
+/// From [`Offer::paths`] or [`Refund::paths`].
+///
+/// [`Offer::paths`]: crate::offers::offer::Offer::paths
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_message_paths(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::CVec_BlindedPathZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.message_paths();
+ let mut local_ret_clone = Vec::new(); local_ret_clone.extend_from_slice(ret); let mut ret = local_ret_clone; let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::lightning::blinded_path::BlindedPath { inner: ObjOps::heap_alloc(item), is_owned: true } }); };
+ local_ret.into()
+}
+
+/// The quantity of items supported.
+///
+/// From [`Offer::supported_quantity`]; `None` if the invoice was created in response to a
+/// [`Refund`].
+///
+/// [`Offer::supported_quantity`]: crate::offers::offer::Offer::supported_quantity
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_supported_quantity(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::offers::offer::Quantity {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
+ let mut local_ret = crate::lightning::offers::offer::Quantity { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+
+/// An unpredictable series of bytes from the payer.
+///
+/// From [`InvoiceRequest::payer_metadata`] or [`Refund::payer_metadata`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_payer_metadata(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::u8slice {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
+ let mut local_ret = crate::c_types::u8slice::from_slice(ret);
+ local_ret
+}
+
+/// Features pertaining to requesting an invoice.
+///
+/// From [`InvoiceRequest::invoice_request_features`] or [`Refund::features`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_invoice_request_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::InvoiceRequestFeatures {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
+ crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
+}
+
+/// The quantity of items requested or refunded for.
+///
+/// From [`InvoiceRequest::quantity`] or [`Refund::quantity`].
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_quantity(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::derived::COption_u64Z {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_u64Z::None } else { crate::c_types::derived::COption_u64Z::Some( { ret.unwrap() }) };
+ local_ret
+}
+
+/// A possibly transient pubkey used to sign the invoice request or to send an invoice for a
+/// refund in case there are no [`message_paths`].
+///
+/// [`message_paths`]: Self::message_paths
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_payer_id(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
+ crate::c_types::PublicKey::from_rust(&ret)
+}
+
+/// A payer-provided note reflected back in the invoice.
+///
+/// From [`InvoiceRequest::payer_note`] or [`Refund::payer_note`].
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_payer_note(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::util::string::PrintableString {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
+ let mut local_ret = crate::lightning::util::string::PrintableString { inner: if ret.is_none() { core::ptr::null_mut() } else { { ObjOps::heap_alloc((ret.unwrap())) } }, is_owned: true };
+ local_ret
+}
+
+/// Duration since the Unix epoch when the invoice was created.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_created_at(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.created_at();
+ ret.as_secs()
+}
+
+/// Duration since [`Bolt12Invoice::created_at`] when the invoice has expired and therefore
+/// should no longer be paid.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_relative_expiry(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.relative_expiry();
+ ret.as_secs()
+}
+
+/// Whether the invoice has expired.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_is_expired(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> bool {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.is_expired();
+ ret
+}
+
+/// SHA256 hash of the payment preimage that will be given in return for paying the invoice.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_payment_hash(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payment_hash();
+ crate::c_types::ThirtyTwoBytes { data: ret.0 }
+}
+
+/// The minimum amount required for a successful payment of the invoice.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_amount_msats(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> u64 {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
+ ret
+}
+
+/// Features pertaining to paying an invoice.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_invoice_features(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::lightning::ln::features::Bolt12InvoiceFeatures {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_features();
+ crate::lightning::ln::features::Bolt12InvoiceFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::Bolt12InvoiceFeatures<>) as *mut _) }, is_owned: false }
+}
+
+/// The public key corresponding to the key used to sign the invoice.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedBolt12Invoice_signing_pubkey(this_arg: &crate::lightning::offers::invoice::UnsignedBolt12Invoice) -> crate::c_types::PublicKey {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
+ crate::c_types::PublicKey::from_rust(&ret)
+}
+
+/// The chains that may be used when paying a requested invoice.
+///
+/// From [`Offer::chains`]; `None` if the invoice was created in response to a [`Refund`].
+///
+/// [`Offer::chains`]: crate::offers::offer::Offer::chains
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Bolt12Invoice_offer_chains(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_chains();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::None } else { crate::c_types::derived::COption_CVec_ThirtyTwoBytesZZ::Some( { let mut local_ret_0 = Vec::new(); for mut item in ret.unwrap().drain(..) { local_ret_0.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); }; local_ret_0.into() }) };
+ local_ret
+}
+
+/// The chain that must be used when paying the invoice; selected from [`offer_chains`] if the
+/// invoice originated from an offer.
+///
+/// From [`InvoiceRequest::chain`] or [`Refund::chain`].
+///
+/// [`offer_chains`]: Self::offer_chains
+/// [`InvoiceRequest::chain`]: crate::offers::invoice_request::InvoiceRequest::chain
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Bolt12Invoice_chain(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::ThirtyTwoBytes {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
+ crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
+}
+
+/// Opaque bytes set by the originating [`Offer`].
+///
+/// From [`Offer::metadata`]; `None` if the invoice was created in response to a [`Refund`] or
+/// if the [`Offer`] did not set it.
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::metadata`]: crate::offers::offer::Offer::metadata
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Bolt12Invoice_metadata(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::c_types::derived::COption_CVec_u8ZZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
+ let mut local_ret = if ret.is_none() { crate::c_types::derived::COption_CVec_u8ZZ::None } else { crate::c_types::derived::COption_CVec_u8ZZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { let mut local_ret_0 = Vec::new(); for mut item in (*ret.as_ref().unwrap()).clone().drain(..) { local_ret_0.push( { item }); }; local_ret_0.into() }) };
+ local_ret
+}
+
+/// The minimum amount required for a successful payment of a single item.
+///
+/// From [`Offer::amount`]; `None` if the invoice was created in response to a [`Refund`] or if
+/// the [`Offer`] did not set it.
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::amount`]: crate::offers::offer::Offer::amount
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Bolt12Invoice_amount(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::offers::offer::Amount {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
+ let mut local_ret = crate::lightning::offers::offer::Amount { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::offers::offer::Amount<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+/// Features pertaining to the originating [`Offer`].
+///
+/// From [`Offer::offer_features`]; `None` if the invoice was created in response to a
+/// [`Refund`].
+///
+/// [`Offer`]: crate::offers::offer::Offer
+/// [`Offer::offer_features`]: crate::offers::offer::Offer::offer_features
+///
+/// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
+#[must_use]
+#[no_mangle]
+pub extern "C" fn Bolt12Invoice_offer_features(this_arg: &crate::lightning::offers::invoice::Bolt12Invoice) -> crate::lightning::ln::features::OfferFeatures {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
+ let mut local_ret = crate::lightning::ln::features::OfferFeatures { inner: unsafe { (if ret.is_none() { core::ptr::null() } else { ObjOps::nonnull_ptr_to_inner( { (ret.unwrap()) }) } as *const lightning::ln::features::OfferFeatures<>) as *mut _ }, is_owned: false };
+ local_ret
+}
+
+/// A complete description of the purpose of the originating offer or refund.
+///
+/// From [`Offer::description`] or [`Refund::description`].
+///
+/// [`Offer::description`]: crate::offers::offer::Offer::description