Update auto-generated bindings to LDK 0.0.121
[ldk-c-bindings] / lightning-c-bindings / src / lightning / offers / invoice_request.rs
1 // This file is Copyright its original authors, visible in version control
2 // history and in the source files from which this was generated.
3 //
4 // This file is licensed under the license available in the LICENSE or LICENSE.md
5 // file in the root of this repository or, if no such file exists, the same
6 // license as that which applies to the original source files from which this
7 // source was automatically generated.
8
9 //! Data structures and encoding for `invoice_request` messages.
10 //!
11 //! An [`InvoiceRequest`] can be built from a parsed [`Offer`] as an \"offer to be paid\". It is
12 //! typically constructed by a customer and sent to the merchant who had published the corresponding
13 //! offer. The recipient of the request responds with a [`Bolt12Invoice`].
14 //!
15 //! For an \"offer for money\" (e.g., refund, ATM withdrawal), where an offer doesn't exist as a
16 //! precursor, see [`Refund`].
17 //!
18 //! [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
19 //! [`Refund`]: crate::offers::refund::Refund
20 //!
21 //! ```
22 //! extern crate bitcoin;
23 //! extern crate lightning;
24 //!
25 //! use bitcoin::network::constants::Network;
26 //! use bitcoin::secp256k1::{KeyPair, PublicKey, Secp256k1, SecretKey};
27 //! use core::convert::Infallible;
28 //! use lightning::ln::features::OfferFeatures;
29 //! use lightning::offers::offer::Offer;
30 //! use lightning::util::ser::Writeable;
31 //!
32 //! # fn parse() -> Result<(), lightning::offers::parse::Bolt12ParseError> {
33 //! let secp_ctx = Secp256k1::new();
34 //! let keys = KeyPair::from_secret_key(&secp_ctx, &SecretKey::from_slice(&[42; 32])?);
35 //! let pubkey = PublicKey::from(keys);
36 //! let mut buffer = Vec::new();
37 //!
38 //! \"lno1qcp4256ypq\"
39 //!     .parse::<Offer>()?
40 //!     .request_invoice(vec![42; 64], pubkey)?
41 //!     .chain(Network::Testnet)?
42 //!     .amount_msats(1000)?
43 //!     .quantity(5)?
44 //!     .payer_note(\"foo\".to_string())
45 //!     .build()?
46 //!     .sign::<_, Infallible>(
47 //!         |message| Ok(secp_ctx.sign_schnorr_no_aux_rand(message.as_ref().as_digest(), &keys))
48 //!     )
49 //!     .expect(\"failed verifying signature\")
50 //!     .write(&mut buffer)
51 //!     .unwrap();
52 //! # Ok(())
53 //! # }
54 //! ```
55
56 use alloc::str::FromStr;
57 use alloc::string::String;
58 use core::ffi::c_void;
59 use core::convert::Infallible;
60 use bitcoin::hashes::Hash;
61 use crate::c_types::*;
62 #[cfg(feature="no-std")]
63 use alloc::{vec::Vec, boxed::Box};
64
65
66 use lightning::offers::invoice_request::UnsignedInvoiceRequest as nativeUnsignedInvoiceRequestImport;
67 pub(crate) type nativeUnsignedInvoiceRequest = nativeUnsignedInvoiceRequestImport;
68
69 /// A semantically valid [`InvoiceRequest`] that hasn't been signed.
70 ///
71 /// # Serialization
72 ///
73 /// This is serialized as a TLV stream, which includes TLV records from the originating message. As
74 /// such, it may include unknown, odd TLV records.
75 #[must_use]
76 #[repr(C)]
77 pub struct UnsignedInvoiceRequest {
78         /// A pointer to the opaque Rust object.
79
80         /// Nearly everywhere, inner must be non-null, however in places where
81         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
82         pub inner: *mut nativeUnsignedInvoiceRequest,
83         /// Indicates that this is the only struct which contains the same pointer.
84
85         /// Rust functions which take ownership of an object provided via an argument require
86         /// this to be true and invalidate the object pointed to by inner.
87         pub is_owned: bool,
88 }
89
90 impl Drop for UnsignedInvoiceRequest {
91         fn drop(&mut self) {
92                 if self.is_owned && !<*mut nativeUnsignedInvoiceRequest>::is_null(self.inner) {
93                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
94                 }
95         }
96 }
97 /// Frees any resources used by the UnsignedInvoiceRequest, if is_owned is set and inner is non-NULL.
98 #[no_mangle]
99 pub extern "C" fn UnsignedInvoiceRequest_free(this_obj: UnsignedInvoiceRequest) { }
100 #[allow(unused)]
101 /// Used only if an object of this type is returned as a trait impl by a method
102 pub(crate) extern "C" fn UnsignedInvoiceRequest_free_void(this_ptr: *mut c_void) {
103         let _ = unsafe { Box::from_raw(this_ptr as *mut nativeUnsignedInvoiceRequest) };
104 }
105 #[allow(unused)]
106 impl UnsignedInvoiceRequest {
107         pub(crate) fn get_native_ref(&self) -> &'static nativeUnsignedInvoiceRequest {
108                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
109         }
110         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeUnsignedInvoiceRequest {
111                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
112         }
113         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
114         pub(crate) fn take_inner(mut self) -> *mut nativeUnsignedInvoiceRequest {
115                 assert!(self.is_owned);
116                 let ret = ObjOps::untweak_ptr(self.inner);
117                 self.inner = core::ptr::null_mut();
118                 ret
119         }
120 }
121 /// Returns the [`TaggedHash`] of the invoice to sign.
122 #[must_use]
123 #[no_mangle]
124 pub extern "C" fn UnsignedInvoiceRequest_tagged_hash(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::merkle::TaggedHash {
125         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.tagged_hash();
126         crate::lightning::offers::merkle::TaggedHash { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::offers::merkle::TaggedHash<>) as *mut _) }, is_owned: false }
127 }
128
129
130 use lightning::offers::invoice_request::InvoiceRequest as nativeInvoiceRequestImport;
131 pub(crate) type nativeInvoiceRequest = nativeInvoiceRequestImport;
132
133 /// An `InvoiceRequest` is a request for a [`Bolt12Invoice`] formulated from an [`Offer`].
134 ///
135 /// An offer may provide choices such as quantity, amount, chain, features, etc. An invoice request
136 /// specifies these such that its recipient can send an invoice for payment.
137 ///
138 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
139 /// [`Offer`]: crate::offers::offer::Offer
140 #[must_use]
141 #[repr(C)]
142 pub struct InvoiceRequest {
143         /// A pointer to the opaque Rust object.
144
145         /// Nearly everywhere, inner must be non-null, however in places where
146         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
147         pub inner: *mut nativeInvoiceRequest,
148         /// Indicates that this is the only struct which contains the same pointer.
149
150         /// Rust functions which take ownership of an object provided via an argument require
151         /// this to be true and invalidate the object pointed to by inner.
152         pub is_owned: bool,
153 }
154
155 impl Drop for InvoiceRequest {
156         fn drop(&mut self) {
157                 if self.is_owned && !<*mut nativeInvoiceRequest>::is_null(self.inner) {
158                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
159                 }
160         }
161 }
162 /// Frees any resources used by the InvoiceRequest, if is_owned is set and inner is non-NULL.
163 #[no_mangle]
164 pub extern "C" fn InvoiceRequest_free(this_obj: InvoiceRequest) { }
165 #[allow(unused)]
166 /// Used only if an object of this type is returned as a trait impl by a method
167 pub(crate) extern "C" fn InvoiceRequest_free_void(this_ptr: *mut c_void) {
168         let _ = unsafe { Box::from_raw(this_ptr as *mut nativeInvoiceRequest) };
169 }
170 #[allow(unused)]
171 impl InvoiceRequest {
172         pub(crate) fn get_native_ref(&self) -> &'static nativeInvoiceRequest {
173                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
174         }
175         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeInvoiceRequest {
176                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
177         }
178         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
179         pub(crate) fn take_inner(mut self) -> *mut nativeInvoiceRequest {
180                 assert!(self.is_owned);
181                 let ret = ObjOps::untweak_ptr(self.inner);
182                 self.inner = core::ptr::null_mut();
183                 ret
184         }
185 }
186 impl Clone for InvoiceRequest {
187         fn clone(&self) -> Self {
188                 Self {
189                         inner: if <*mut nativeInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else {
190                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
191                         is_owned: true,
192                 }
193         }
194 }
195 #[allow(unused)]
196 /// Used only if an object of this type is returned as a trait impl by a method
197 pub(crate) extern "C" fn InvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
198         Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeInvoiceRequest)).clone() })) as *mut c_void
199 }
200 #[no_mangle]
201 /// Creates a copy of the InvoiceRequest
202 pub extern "C" fn InvoiceRequest_clone(orig: &InvoiceRequest) -> InvoiceRequest {
203         orig.clone()
204 }
205 /// Get a string which allows debug introspection of a InvoiceRequest object
206 pub extern "C" fn InvoiceRequest_debug_str_void(o: *const c_void) -> Str {
207         alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::invoice_request::InvoiceRequest }).into()}
208
209 use lightning::offers::invoice_request::VerifiedInvoiceRequest as nativeVerifiedInvoiceRequestImport;
210 pub(crate) type nativeVerifiedInvoiceRequest = nativeVerifiedInvoiceRequestImport;
211
212 /// An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
213 /// ways to respond depending on whether the signing keys were derived.
214 #[must_use]
215 #[repr(C)]
216 pub struct VerifiedInvoiceRequest {
217         /// A pointer to the opaque Rust object.
218
219         /// Nearly everywhere, inner must be non-null, however in places where
220         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
221         pub inner: *mut nativeVerifiedInvoiceRequest,
222         /// Indicates that this is the only struct which contains the same pointer.
223
224         /// Rust functions which take ownership of an object provided via an argument require
225         /// this to be true and invalidate the object pointed to by inner.
226         pub is_owned: bool,
227 }
228
229 impl Drop for VerifiedInvoiceRequest {
230         fn drop(&mut self) {
231                 if self.is_owned && !<*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) {
232                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
233                 }
234         }
235 }
236 /// Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL.
237 #[no_mangle]
238 pub extern "C" fn VerifiedInvoiceRequest_free(this_obj: VerifiedInvoiceRequest) { }
239 #[allow(unused)]
240 /// Used only if an object of this type is returned as a trait impl by a method
241 pub(crate) extern "C" fn VerifiedInvoiceRequest_free_void(this_ptr: *mut c_void) {
242         let _ = unsafe { Box::from_raw(this_ptr as *mut nativeVerifiedInvoiceRequest) };
243 }
244 #[allow(unused)]
245 impl VerifiedInvoiceRequest {
246         pub(crate) fn get_native_ref(&self) -> &'static nativeVerifiedInvoiceRequest {
247                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
248         }
249         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeVerifiedInvoiceRequest {
250                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
251         }
252         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
253         pub(crate) fn take_inner(mut self) -> *mut nativeVerifiedInvoiceRequest {
254                 assert!(self.is_owned);
255                 let ret = ObjOps::untweak_ptr(self.inner);
256                 self.inner = core::ptr::null_mut();
257                 ret
258         }
259 }
260 /// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
261 ///
262 /// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
263 /// [`respond_with`].
264 ///
265 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
266 /// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
267 /// [`respond_with`]: Self::respond_with
268 #[no_mangle]
269 pub extern "C" fn VerifiedInvoiceRequest_get_keys(this_ptr: &VerifiedInvoiceRequest) -> crate::c_types::derived::COption_SecretKeyZ {
270         let mut inner_val = &mut this_ptr.get_native_mut_ref().keys;
271         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()) }) };
272         local_inner_val
273 }
274 /// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
275 ///
276 /// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
277 /// [`respond_with`].
278 ///
279 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
280 /// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
281 /// [`respond_with`]: Self::respond_with
282 #[no_mangle]
283 pub extern "C" fn VerifiedInvoiceRequest_set_keys(this_ptr: &mut VerifiedInvoiceRequest, mut val: crate::c_types::derived::COption_SecretKeyZ) {
284         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()) }})} };
285         unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys = local_val;
286 }
287 impl Clone for VerifiedInvoiceRequest {
288         fn clone(&self) -> Self {
289                 Self {
290                         inner: if <*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else {
291                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
292                         is_owned: true,
293                 }
294         }
295 }
296 #[allow(unused)]
297 /// Used only if an object of this type is returned as a trait impl by a method
298 pub(crate) extern "C" fn VerifiedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
299         Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void
300 }
301 #[no_mangle]
302 /// Creates a copy of the VerifiedInvoiceRequest
303 pub extern "C" fn VerifiedInvoiceRequest_clone(orig: &VerifiedInvoiceRequest) -> VerifiedInvoiceRequest {
304         orig.clone()
305 }
306 /// Get a string which allows debug introspection of a VerifiedInvoiceRequest object
307 pub extern "C" fn VerifiedInvoiceRequest_debug_str_void(o: *const c_void) -> Str {
308         alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::invoice_request::VerifiedInvoiceRequest }).into()}
309 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
310 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
311 /// for the selected chain.
312 #[must_use]
313 #[no_mangle]
314 pub extern "C" fn UnsignedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
315         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
316         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); };
317         local_ret.into()
318 }
319
320 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
321 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
322 #[must_use]
323 #[no_mangle]
324 pub extern "C" fn UnsignedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
325         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
326         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() }) };
327         local_ret
328 }
329
330 /// The minimum amount required for a successful payment of a single item.
331 ///
332 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
333 #[must_use]
334 #[no_mangle]
335 pub extern "C" fn UnsignedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Amount {
336         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
337         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 };
338         local_ret
339 }
340
341 /// A complete description of the purpose of the payment. Intended to be displayed to the user
342 /// but with the caveat that it has not been verified in any way.
343 #[must_use]
344 #[no_mangle]
345 pub extern "C" fn UnsignedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
346         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
347         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
348 }
349
350 /// Features pertaining to the offer.
351 #[must_use]
352 #[no_mangle]
353 pub extern "C" fn UnsignedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
354         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
355         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
356 }
357
358 /// Duration since the Unix epoch when an invoice should no longer be requested.
359 ///
360 /// If `None`, the offer does not expire.
361 #[must_use]
362 #[no_mangle]
363 pub extern "C" fn UnsignedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
364         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
365         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() }) };
366         local_ret
367 }
368
369 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
370 /// displayed to the user but with the caveat that it has not been verified in any way.
371 ///
372 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
373 #[must_use]
374 #[no_mangle]
375 pub extern "C" fn UnsignedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
376         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
377         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 };
378         local_ret
379 }
380
381 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
382 /// recipient privacy by obfuscating its node id.
383 #[must_use]
384 #[no_mangle]
385 pub extern "C" fn UnsignedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
386         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
387         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 } }); };
388         local_ret.into()
389 }
390
391 /// The quantity of items supported.
392 #[must_use]
393 #[no_mangle]
394 pub extern "C" fn UnsignedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Quantity {
395         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
396         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
397 }
398
399 /// The public key used by the recipient to sign invoices.
400 #[must_use]
401 #[no_mangle]
402 pub extern "C" fn UnsignedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey {
403         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
404         crate::c_types::PublicKey::from_rust(&ret)
405 }
406
407 /// An unpredictable series of bytes, typically containing information about the derivation of
408 /// [`payer_id`].
409 ///
410 /// [`payer_id`]: Self::payer_id
411 #[must_use]
412 #[no_mangle]
413 pub extern "C" fn UnsignedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::u8slice {
414         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
415         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
416         local_ret
417 }
418
419 /// A chain from [`Offer::chains`] that the offer is valid for.
420 #[must_use]
421 #[no_mangle]
422 pub extern "C" fn UnsignedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
423         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
424         crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() }
425 }
426
427 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
428 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
429 ///
430 /// [`chain`]: Self::chain
431 #[must_use]
432 #[no_mangle]
433 pub extern "C" fn UnsignedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
434         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
435         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() }) };
436         local_ret
437 }
438
439 /// Features pertaining to requesting an invoice.
440 #[must_use]
441 #[no_mangle]
442 pub extern "C" fn UnsignedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
443         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
444         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
445 }
446
447 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
448 #[must_use]
449 #[no_mangle]
450 pub extern "C" fn UnsignedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
451         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
452         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() }) };
453         local_ret
454 }
455
456 /// A possibly transient pubkey used to sign the invoice request.
457 #[must_use]
458 #[no_mangle]
459 pub extern "C" fn UnsignedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey {
460         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
461         crate::c_types::PublicKey::from_rust(&ret)
462 }
463
464 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
465 /// response.
466 ///
467 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
468 #[must_use]
469 #[no_mangle]
470 pub extern "C" fn UnsignedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
471         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
472         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 };
473         local_ret
474 }
475
476 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
477 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
478 /// for the selected chain.
479 #[must_use]
480 #[no_mangle]
481 pub extern "C" fn InvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
482         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
483         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); };
484         local_ret.into()
485 }
486
487 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
488 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
489 #[must_use]
490 #[no_mangle]
491 pub extern "C" fn InvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
492         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
493         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() }) };
494         local_ret
495 }
496
497 /// The minimum amount required for a successful payment of a single item.
498 ///
499 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
500 #[must_use]
501 #[no_mangle]
502 pub extern "C" fn InvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Amount {
503         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
504         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 };
505         local_ret
506 }
507
508 /// A complete description of the purpose of the payment. Intended to be displayed to the user
509 /// but with the caveat that it has not been verified in any way.
510 #[must_use]
511 #[no_mangle]
512 pub extern "C" fn InvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
513         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
514         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
515 }
516
517 /// Features pertaining to the offer.
518 #[must_use]
519 #[no_mangle]
520 pub extern "C" fn InvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
521         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
522         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
523 }
524
525 /// Duration since the Unix epoch when an invoice should no longer be requested.
526 ///
527 /// If `None`, the offer does not expire.
528 #[must_use]
529 #[no_mangle]
530 pub extern "C" fn InvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
531         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
532         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() }) };
533         local_ret
534 }
535
536 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
537 /// displayed to the user but with the caveat that it has not been verified in any way.
538 ///
539 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
540 #[must_use]
541 #[no_mangle]
542 pub extern "C" fn InvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
543         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
544         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 };
545         local_ret
546 }
547
548 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
549 /// recipient privacy by obfuscating its node id.
550 #[must_use]
551 #[no_mangle]
552 pub extern "C" fn InvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
553         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
554         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 } }); };
555         local_ret.into()
556 }
557
558 /// The quantity of items supported.
559 #[must_use]
560 #[no_mangle]
561 pub extern "C" fn InvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Quantity {
562         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
563         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
564 }
565
566 /// The public key used by the recipient to sign invoices.
567 #[must_use]
568 #[no_mangle]
569 pub extern "C" fn InvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey {
570         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
571         crate::c_types::PublicKey::from_rust(&ret)
572 }
573
574 /// An unpredictable series of bytes, typically containing information about the derivation of
575 /// [`payer_id`].
576 ///
577 /// [`payer_id`]: Self::payer_id
578 #[must_use]
579 #[no_mangle]
580 pub extern "C" fn InvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::u8slice {
581         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
582         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
583         local_ret
584 }
585
586 /// A chain from [`Offer::chains`] that the offer is valid for.
587 #[must_use]
588 #[no_mangle]
589 pub extern "C" fn InvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
590         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
591         crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() }
592 }
593
594 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
595 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
596 ///
597 /// [`chain`]: Self::chain
598 #[must_use]
599 #[no_mangle]
600 pub extern "C" fn InvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
601         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
602         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() }) };
603         local_ret
604 }
605
606 /// Features pertaining to requesting an invoice.
607 #[must_use]
608 #[no_mangle]
609 pub extern "C" fn InvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
610         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
611         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
612 }
613
614 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
615 #[must_use]
616 #[no_mangle]
617 pub extern "C" fn InvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
618         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
619         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() }) };
620         local_ret
621 }
622
623 /// A possibly transient pubkey used to sign the invoice request.
624 #[must_use]
625 #[no_mangle]
626 pub extern "C" fn InvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey {
627         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
628         crate::c_types::PublicKey::from_rust(&ret)
629 }
630
631 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
632 /// response.
633 ///
634 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
635 #[must_use]
636 #[no_mangle]
637 pub extern "C" fn InvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
638         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
639         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 };
640         local_ret
641 }
642
643 /// Signature of the invoice request using [`payer_id`].
644 ///
645 /// [`payer_id`]: Self::payer_id
646 #[must_use]
647 #[no_mangle]
648 pub extern "C" fn InvoiceRequest_signature(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::SchnorrSignature {
649         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature();
650         crate::c_types::SchnorrSignature::from_rust(&ret)
651 }
652
653 /// Verifies that the request was for an offer created using the given key. Returns the verified
654 /// request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request
655 /// if they could be extracted from the metadata.
656 ///
657 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
658 #[must_use]
659 #[no_mangle]
660 pub extern "C" fn InvoiceRequest_verify(mut this_arg: crate::lightning::offers::invoice_request::InvoiceRequest, key: &crate::lightning::ln::inbound_payment::ExpandedKey) -> crate::c_types::derived::CResult_VerifiedInvoiceRequestNoneZ {
661         let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).verify(key.get_native_ref(), secp256k1::global::SECP256K1);
662         let mut local_ret = match ret { Ok(mut o) => crate::c_types::CResultTempl::ok( { crate::lightning::offers::invoice_request::VerifiedInvoiceRequest { inner: ObjOps::heap_alloc(o), is_owned: true } }).into(), Err(mut e) => crate::c_types::CResultTempl::err( { () /*e*/ }).into() };
663         local_ret
664 }
665
666 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
667 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
668 /// for the selected chain.
669 #[must_use]
670 #[no_mangle]
671 pub extern "C" fn VerifiedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
672         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
673         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: *item.as_ref() } }); };
674         local_ret.into()
675 }
676
677 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
678 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
679 #[must_use]
680 #[no_mangle]
681 pub extern "C" fn VerifiedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
682         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
683         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() }) };
684         local_ret
685 }
686
687 /// The minimum amount required for a successful payment of a single item.
688 ///
689 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
690 #[must_use]
691 #[no_mangle]
692 pub extern "C" fn VerifiedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Amount {
693         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
694         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 };
695         local_ret
696 }
697
698 /// A complete description of the purpose of the payment. Intended to be displayed to the user
699 /// but with the caveat that it has not been verified in any way.
700 #[must_use]
701 #[no_mangle]
702 pub extern "C" fn VerifiedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
703         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
704         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
705 }
706
707 /// Features pertaining to the offer.
708 #[must_use]
709 #[no_mangle]
710 pub extern "C" fn VerifiedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
711         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
712         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
713 }
714
715 /// Duration since the Unix epoch when an invoice should no longer be requested.
716 ///
717 /// If `None`, the offer does not expire.
718 #[must_use]
719 #[no_mangle]
720 pub extern "C" fn VerifiedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
721         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
722         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() }) };
723         local_ret
724 }
725
726 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
727 /// displayed to the user but with the caveat that it has not been verified in any way.
728 ///
729 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
730 #[must_use]
731 #[no_mangle]
732 pub extern "C" fn VerifiedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
733         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
734         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 };
735         local_ret
736 }
737
738 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
739 /// recipient privacy by obfuscating its node id.
740 #[must_use]
741 #[no_mangle]
742 pub extern "C" fn VerifiedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
743         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
744         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 } }); };
745         local_ret.into()
746 }
747
748 /// The quantity of items supported.
749 #[must_use]
750 #[no_mangle]
751 pub extern "C" fn VerifiedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Quantity {
752         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
753         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
754 }
755
756 /// The public key used by the recipient to sign invoices.
757 #[must_use]
758 #[no_mangle]
759 pub extern "C" fn VerifiedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey {
760         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
761         crate::c_types::PublicKey::from_rust(&ret)
762 }
763
764 /// An unpredictable series of bytes, typically containing information about the derivation of
765 /// [`payer_id`].
766 ///
767 /// [`payer_id`]: Self::payer_id
768 #[must_use]
769 #[no_mangle]
770 pub extern "C" fn VerifiedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::u8slice {
771         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
772         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
773         local_ret
774 }
775
776 /// A chain from [`Offer::chains`] that the offer is valid for.
777 #[must_use]
778 #[no_mangle]
779 pub extern "C" fn VerifiedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
780         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
781         crate::c_types::ThirtyTwoBytes { data: *ret.as_ref() }
782 }
783
784 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
785 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
786 ///
787 /// [`chain`]: Self::chain
788 #[must_use]
789 #[no_mangle]
790 pub extern "C" fn VerifiedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
791         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
792         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() }) };
793         local_ret
794 }
795
796 /// Features pertaining to requesting an invoice.
797 #[must_use]
798 #[no_mangle]
799 pub extern "C" fn VerifiedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
800         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
801         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
802 }
803
804 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
805 #[must_use]
806 #[no_mangle]
807 pub extern "C" fn VerifiedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
808         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
809         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() }) };
810         local_ret
811 }
812
813 /// A possibly transient pubkey used to sign the invoice request.
814 #[must_use]
815 #[no_mangle]
816 pub extern "C" fn VerifiedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey {
817         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
818         crate::c_types::PublicKey::from_rust(&ret)
819 }
820
821 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
822 /// response.
823 ///
824 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
825 #[must_use]
826 #[no_mangle]
827 pub extern "C" fn VerifiedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
828         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
829         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 };
830         local_ret
831 }
832
833 #[no_mangle]
834 /// Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read
835 pub extern "C" fn UnsignedInvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
836         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
837 }
838 #[allow(unused)]
839 pub(crate) extern "C" fn UnsignedInvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
840         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedInvoiceRequest) })
841 }
842 #[no_mangle]
843 /// Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
844 pub extern "C" fn InvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
845         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
846 }
847 #[allow(unused)]
848 pub(crate) extern "C" fn InvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
849         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceRequest) })
850 }