+
+use lightning::offers::invoice_request::VerifiedInvoiceRequest as nativeVerifiedInvoiceRequestImport;
+pub(crate) type nativeVerifiedInvoiceRequest = nativeVerifiedInvoiceRequestImport;
+
+/// An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
+/// ways to respond depending on whether the signing keys were derived.
+#[must_use]
+#[repr(C)]
+pub struct VerifiedInvoiceRequest {
+ /// A pointer to the opaque Rust object.
+
+ /// Nearly everywhere, inner must be non-null, however in places where
+ /// the Rust equivalent takes an Option, it may be set to null to indicate None.
+ pub inner: *mut nativeVerifiedInvoiceRequest,
+ /// Indicates that this is the only struct which contains the same pointer.
+
+ /// Rust functions which take ownership of an object provided via an argument require
+ /// this to be true and invalidate the object pointed to by inner.
+ pub is_owned: bool,
+}
+
+impl Drop for VerifiedInvoiceRequest {
+ fn drop(&mut self) {
+ if self.is_owned && !<*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) {
+ let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
+ }
+ }
+}
+/// Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL.
+#[no_mangle]
+pub extern "C" fn VerifiedInvoiceRequest_free(this_obj: VerifiedInvoiceRequest) { }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn VerifiedInvoiceRequest_free_void(this_ptr: *mut c_void) {
+ let _ = unsafe { Box::from_raw(this_ptr as *mut nativeVerifiedInvoiceRequest) };
+}
+#[allow(unused)]
+impl VerifiedInvoiceRequest {
+ pub(crate) fn get_native_ref(&self) -> &'static nativeVerifiedInvoiceRequest {
+ unsafe { &*ObjOps::untweak_ptr(self.inner) }
+ }
+ pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeVerifiedInvoiceRequest {
+ unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
+ }
+ /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
+ pub(crate) fn take_inner(mut self) -> *mut nativeVerifiedInvoiceRequest {
+ assert!(self.is_owned);
+ let ret = ObjOps::untweak_ptr(self.inner);
+ self.inner = core::ptr::null_mut();
+ ret
+ }
+}
+/// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
+///
+/// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
+/// [`respond_with`].
+///
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+/// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
+/// [`respond_with`]: Self::respond_with
+#[no_mangle]
+pub extern "C" fn VerifiedInvoiceRequest_get_keys(this_ptr: &VerifiedInvoiceRequest) -> crate::c_types::derived::COption_SecretKeyZ {
+ let mut inner_val = &mut this_ptr.get_native_mut_ref().keys;
+ let mut local_inner_val = if inner_val.is_none() { crate::c_types::derived::COption_SecretKeyZ::None } else { crate::c_types::derived::COption_SecretKeyZ::Some(/* WARNING: CLONING CONVERSION HERE! &Option<Enum> is otherwise un-expressable. */ { crate::c_types::SecretKey::from_rust((*inner_val.as_ref().unwrap()).clone().secret_key()) }) };
+ local_inner_val
+}
+/// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
+///
+/// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
+/// [`respond_with`].
+///
+/// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
+/// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
+/// [`respond_with`]: Self::respond_with
+#[no_mangle]
+pub extern "C" fn VerifiedInvoiceRequest_set_keys(this_ptr: &mut VerifiedInvoiceRequest, mut val: crate::c_types::derived::COption_SecretKeyZ) {
+ let mut local_val = { /*val*/ let val_opt = val; if val_opt.is_none() { None } else { Some({ { ::bitcoin::secp256k1::KeyPair::from_secret_key(&secp256k1::global::SECP256K1, &{ val_opt.take() }.into_rust()) }})} };
+ unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys = local_val;
+}
+impl Clone for VerifiedInvoiceRequest {
+ fn clone(&self) -> Self {
+ Self {
+ inner: if <*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else {
+ ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
+ is_owned: true,
+ }
+ }
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn VerifiedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
+ Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void
+}
+#[no_mangle]
+/// Creates a copy of the VerifiedInvoiceRequest
+pub extern "C" fn VerifiedInvoiceRequest_clone(orig: &VerifiedInvoiceRequest) -> VerifiedInvoiceRequest {
+ orig.clone()
+}
+/// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
+/// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
+/// for the selected chain.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
+ let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); };
+ local_ret.into()
+}
+
+/// Opaque bytes set by the originator. Useful for authentication and validating fields since it
+/// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> 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.
+///
+/// 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 UnsignedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> 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
+}
+
+/// A complete description of the purpose of the payment. Intended to be displayed to the user
+/// but with the caveat that it has not been verified in any way.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> 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 }
+}
+
+/// Features pertaining to the offer.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
+ crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
+}
+
+/// Duration since the Unix epoch when an invoice should no longer be requested.
+///
+/// If `None`, the offer does not expire.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> 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, possibly beginning with `user@domain` or `domain`. Intended to be
+/// displayed to the user but with the caveat that it has not been verified in any way.
+///
+/// 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 UnsignedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> 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. Blinded paths provide
+/// recipient privacy by obfuscating its node id.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.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.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Quantity {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
+ crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
+}
+
+/// The public key used by the recipient to sign invoices.
+#[must_use]
+#[no_mangle]
+pub extern "C" fn UnsignedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey {
+ let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
+ crate::c_types::PublicKey::from_rust(&ret)
+}
+