Update auto-generated bindings
[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 *mut 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
206 use lightning::offers::invoice_request::VerifiedInvoiceRequest as nativeVerifiedInvoiceRequestImport;
207 pub(crate) type nativeVerifiedInvoiceRequest = nativeVerifiedInvoiceRequestImport;
208
209 /// An [`InvoiceRequest`] that has been verified by [`InvoiceRequest::verify`] and exposes different
210 /// ways to respond depending on whether the signing keys were derived.
211 #[must_use]
212 #[repr(C)]
213 pub struct VerifiedInvoiceRequest {
214         /// A pointer to the opaque Rust object.
215
216         /// Nearly everywhere, inner must be non-null, however in places where
217         /// the Rust equivalent takes an Option, it may be set to null to indicate None.
218         pub inner: *mut nativeVerifiedInvoiceRequest,
219         /// Indicates that this is the only struct which contains the same pointer.
220
221         /// Rust functions which take ownership of an object provided via an argument require
222         /// this to be true and invalidate the object pointed to by inner.
223         pub is_owned: bool,
224 }
225
226 impl Drop for VerifiedInvoiceRequest {
227         fn drop(&mut self) {
228                 if self.is_owned && !<*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) {
229                         let _ = unsafe { Box::from_raw(ObjOps::untweak_ptr(self.inner)) };
230                 }
231         }
232 }
233 /// Frees any resources used by the VerifiedInvoiceRequest, if is_owned is set and inner is non-NULL.
234 #[no_mangle]
235 pub extern "C" fn VerifiedInvoiceRequest_free(this_obj: VerifiedInvoiceRequest) { }
236 #[allow(unused)]
237 /// Used only if an object of this type is returned as a trait impl by a method
238 pub(crate) extern "C" fn VerifiedInvoiceRequest_free_void(this_ptr: *mut c_void) {
239         let _ = unsafe { Box::from_raw(this_ptr as *mut nativeVerifiedInvoiceRequest) };
240 }
241 #[allow(unused)]
242 impl VerifiedInvoiceRequest {
243         pub(crate) fn get_native_ref(&self) -> &'static nativeVerifiedInvoiceRequest {
244                 unsafe { &*ObjOps::untweak_ptr(self.inner) }
245         }
246         pub(crate) fn get_native_mut_ref(&self) -> &'static mut nativeVerifiedInvoiceRequest {
247                 unsafe { &mut *ObjOps::untweak_ptr(self.inner) }
248         }
249         /// When moving out of the pointer, we have to ensure we aren't a reference, this makes that easy
250         pub(crate) fn take_inner(mut self) -> *mut nativeVerifiedInvoiceRequest {
251                 assert!(self.is_owned);
252                 let ret = ObjOps::untweak_ptr(self.inner);
253                 self.inner = core::ptr::null_mut();
254                 ret
255         }
256 }
257 /// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
258 ///
259 /// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
260 /// [`respond_with`].
261 ///
262 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
263 /// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
264 /// [`respond_with`]: Self::respond_with
265 #[no_mangle]
266 pub extern "C" fn VerifiedInvoiceRequest_get_keys(this_ptr: &VerifiedInvoiceRequest) -> crate::c_types::derived::COption_SecretKeyZ {
267         let mut inner_val = &mut this_ptr.get_native_mut_ref().keys;
268         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()) }) };
269         local_inner_val
270 }
271 /// Keys used for signing a [`Bolt12Invoice`] if they can be derived.
272 ///
273 /// If `Some`, must call [`respond_using_derived_keys`] when responding. Otherwise, call
274 /// [`respond_with`].
275 ///
276 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
277 /// [`respond_using_derived_keys`]: Self::respond_using_derived_keys
278 /// [`respond_with`]: Self::respond_with
279 #[no_mangle]
280 pub extern "C" fn VerifiedInvoiceRequest_set_keys(this_ptr: &mut VerifiedInvoiceRequest, mut val: crate::c_types::derived::COption_SecretKeyZ) {
281         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()) }})} };
282         unsafe { &mut *ObjOps::untweak_ptr(this_ptr.inner) }.keys = local_val;
283 }
284 impl Clone for VerifiedInvoiceRequest {
285         fn clone(&self) -> Self {
286                 Self {
287                         inner: if <*mut nativeVerifiedInvoiceRequest>::is_null(self.inner) { core::ptr::null_mut() } else {
288                                 ObjOps::heap_alloc(unsafe { &*ObjOps::untweak_ptr(self.inner) }.clone()) },
289                         is_owned: true,
290                 }
291         }
292 }
293 #[allow(unused)]
294 /// Used only if an object of this type is returned as a trait impl by a method
295 pub(crate) extern "C" fn VerifiedInvoiceRequest_clone_void(this_ptr: *const c_void) -> *mut c_void {
296         Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeVerifiedInvoiceRequest)).clone() })) as *mut c_void
297 }
298 #[no_mangle]
299 /// Creates a copy of the VerifiedInvoiceRequest
300 pub extern "C" fn VerifiedInvoiceRequest_clone(orig: &VerifiedInvoiceRequest) -> VerifiedInvoiceRequest {
301         orig.clone()
302 }
303 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
304 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
305 /// for the selected chain.
306 #[must_use]
307 #[no_mangle]
308 pub extern "C" fn UnsignedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
309         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
310         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); };
311         local_ret.into()
312 }
313
314 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
315 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
316 #[must_use]
317 #[no_mangle]
318 pub extern "C" fn UnsignedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
319         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
320         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() }) };
321         local_ret
322 }
323
324 /// The minimum amount required for a successful payment of a single item.
325 ///
326 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
327 #[must_use]
328 #[no_mangle]
329 pub extern "C" fn UnsignedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Amount {
330         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
331         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 };
332         local_ret
333 }
334
335 /// A complete description of the purpose of the payment. Intended to be displayed to the user
336 /// but with the caveat that it has not been verified in any way.
337 #[must_use]
338 #[no_mangle]
339 pub extern "C" fn UnsignedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
340         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
341         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
342 }
343
344 /// Features pertaining to the offer.
345 #[must_use]
346 #[no_mangle]
347 pub extern "C" fn UnsignedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
348         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
349         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
350 }
351
352 /// Duration since the Unix epoch when an invoice should no longer be requested.
353 ///
354 /// If `None`, the offer does not expire.
355 #[must_use]
356 #[no_mangle]
357 pub extern "C" fn UnsignedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
358         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
359         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() }) };
360         local_ret
361 }
362
363 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
364 /// displayed to the user but with the caveat that it has not been verified in any way.
365 ///
366 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
367 #[must_use]
368 #[no_mangle]
369 pub extern "C" fn UnsignedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
370         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
371         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 };
372         local_ret
373 }
374
375 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
376 /// recipient privacy by obfuscating its node id.
377 #[must_use]
378 #[no_mangle]
379 pub extern "C" fn UnsignedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
380         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
381         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 } }); };
382         local_ret.into()
383 }
384
385 /// The quantity of items supported.
386 #[must_use]
387 #[no_mangle]
388 pub extern "C" fn UnsignedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::offers::offer::Quantity {
389         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
390         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
391 }
392
393 /// The public key used by the recipient to sign invoices.
394 #[must_use]
395 #[no_mangle]
396 pub extern "C" fn UnsignedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey {
397         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
398         crate::c_types::PublicKey::from_rust(&ret)
399 }
400
401 /// An unpredictable series of bytes, typically containing information about the derivation of
402 /// [`payer_id`].
403 ///
404 /// [`payer_id`]: Self::payer_id
405 #[must_use]
406 #[no_mangle]
407 pub extern "C" fn UnsignedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::u8slice {
408         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
409         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
410         local_ret
411 }
412
413 /// A chain from [`Offer::chains`] that the offer is valid for.
414 #[must_use]
415 #[no_mangle]
416 pub extern "C" fn UnsignedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
417         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
418         crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
419 }
420
421 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
422 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
423 ///
424 /// [`chain`]: Self::chain
425 #[must_use]
426 #[no_mangle]
427 pub extern "C" fn UnsignedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
428         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
429         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() }) };
430         local_ret
431 }
432
433 /// Features pertaining to requesting an invoice.
434 #[must_use]
435 #[no_mangle]
436 pub extern "C" fn UnsignedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
437         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
438         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
439 }
440
441 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
442 #[must_use]
443 #[no_mangle]
444 pub extern "C" fn UnsignedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
445         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
446         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() }) };
447         local_ret
448 }
449
450 /// A possibly transient pubkey used to sign the invoice request.
451 #[must_use]
452 #[no_mangle]
453 pub extern "C" fn UnsignedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::PublicKey {
454         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
455         crate::c_types::PublicKey::from_rust(&ret)
456 }
457
458 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
459 /// response.
460 ///
461 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
462 #[must_use]
463 #[no_mangle]
464 pub extern "C" fn UnsignedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
465         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
466         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 };
467         local_ret
468 }
469
470 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
471 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
472 /// for the selected chain.
473 #[must_use]
474 #[no_mangle]
475 pub extern "C" fn InvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
476         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
477         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); };
478         local_ret.into()
479 }
480
481 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
482 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
483 #[must_use]
484 #[no_mangle]
485 pub extern "C" fn InvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
486         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
487         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() }) };
488         local_ret
489 }
490
491 /// The minimum amount required for a successful payment of a single item.
492 ///
493 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
494 #[must_use]
495 #[no_mangle]
496 pub extern "C" fn InvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Amount {
497         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
498         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 };
499         local_ret
500 }
501
502 /// A complete description of the purpose of the payment. Intended to be displayed to the user
503 /// but with the caveat that it has not been verified in any way.
504 #[must_use]
505 #[no_mangle]
506 pub extern "C" fn InvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
507         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
508         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
509 }
510
511 /// Features pertaining to the offer.
512 #[must_use]
513 #[no_mangle]
514 pub extern "C" fn InvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
515         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
516         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
517 }
518
519 /// Duration since the Unix epoch when an invoice should no longer be requested.
520 ///
521 /// If `None`, the offer does not expire.
522 #[must_use]
523 #[no_mangle]
524 pub extern "C" fn InvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
525         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
526         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() }) };
527         local_ret
528 }
529
530 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
531 /// displayed to the user but with the caveat that it has not been verified in any way.
532 ///
533 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
534 #[must_use]
535 #[no_mangle]
536 pub extern "C" fn InvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
537         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
538         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 };
539         local_ret
540 }
541
542 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
543 /// recipient privacy by obfuscating its node id.
544 #[must_use]
545 #[no_mangle]
546 pub extern "C" fn InvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
547         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
548         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 } }); };
549         local_ret.into()
550 }
551
552 /// The quantity of items supported.
553 #[must_use]
554 #[no_mangle]
555 pub extern "C" fn InvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::offers::offer::Quantity {
556         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
557         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
558 }
559
560 /// The public key used by the recipient to sign invoices.
561 #[must_use]
562 #[no_mangle]
563 pub extern "C" fn InvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey {
564         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
565         crate::c_types::PublicKey::from_rust(&ret)
566 }
567
568 /// An unpredictable series of bytes, typically containing information about the derivation of
569 /// [`payer_id`].
570 ///
571 /// [`payer_id`]: Self::payer_id
572 #[must_use]
573 #[no_mangle]
574 pub extern "C" fn InvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::u8slice {
575         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
576         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
577         local_ret
578 }
579
580 /// A chain from [`Offer::chains`] that the offer is valid for.
581 #[must_use]
582 #[no_mangle]
583 pub extern "C" fn InvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
584         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
585         crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
586 }
587
588 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
589 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
590 ///
591 /// [`chain`]: Self::chain
592 #[must_use]
593 #[no_mangle]
594 pub extern "C" fn InvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
595         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
596         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() }) };
597         local_ret
598 }
599
600 /// Features pertaining to requesting an invoice.
601 #[must_use]
602 #[no_mangle]
603 pub extern "C" fn InvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
604         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
605         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
606 }
607
608 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
609 #[must_use]
610 #[no_mangle]
611 pub extern "C" fn InvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::COption_u64Z {
612         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
613         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() }) };
614         local_ret
615 }
616
617 /// A possibly transient pubkey used to sign the invoice request.
618 #[must_use]
619 #[no_mangle]
620 pub extern "C" fn InvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::PublicKey {
621         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
622         crate::c_types::PublicKey::from_rust(&ret)
623 }
624
625 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
626 /// response.
627 ///
628 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
629 #[must_use]
630 #[no_mangle]
631 pub extern "C" fn InvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::lightning::util::string::PrintableString {
632         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
633         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 };
634         local_ret
635 }
636
637 /// Signature of the invoice request using [`payer_id`].
638 ///
639 /// [`payer_id`]: Self::payer_id
640 #[must_use]
641 #[no_mangle]
642 pub extern "C" fn InvoiceRequest_signature(this_arg: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::SchnorrSignature {
643         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signature();
644         crate::c_types::SchnorrSignature::from_rust(&ret)
645 }
646
647 /// Verifies that the request was for an offer created using the given key. Returns the verified
648 /// request which contains the derived keys needed to sign a [`Bolt12Invoice`] for the request
649 /// if they could be extracted from the metadata.
650 ///
651 /// [`Bolt12Invoice`]: crate::offers::invoice::Bolt12Invoice
652 #[must_use]
653 #[no_mangle]
654 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 {
655         let mut ret = (*unsafe { Box::from_raw(this_arg.take_inner()) }).verify(key.get_native_ref(), secp256k1::global::SECP256K1);
656         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() };
657         local_ret
658 }
659
660 /// The chains that may be used when paying a requested invoice (e.g., bitcoin mainnet).
661 /// Payments must be denominated in units of the minimal lightning-payable unit (e.g., msats)
662 /// for the selected chain.
663 #[must_use]
664 #[no_mangle]
665 pub extern "C" fn VerifiedInvoiceRequest_chains(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_ThirtyTwoBytesZ {
666         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chains();
667         let mut local_ret = Vec::new(); for mut item in ret.drain(..) { local_ret.push( { crate::c_types::ThirtyTwoBytes { data: item.to_bytes() } }); };
668         local_ret.into()
669 }
670
671 /// Opaque bytes set by the originator. Useful for authentication and validating fields since it
672 /// is reflected in `invoice_request` messages along with all the other fields from the `offer`.
673 #[must_use]
674 #[no_mangle]
675 pub extern "C" fn VerifiedInvoiceRequest_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_CVec_u8ZZ {
676         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.metadata();
677         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() }) };
678         local_ret
679 }
680
681 /// The minimum amount required for a successful payment of a single item.
682 ///
683 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
684 #[must_use]
685 #[no_mangle]
686 pub extern "C" fn VerifiedInvoiceRequest_amount(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Amount {
687         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount();
688         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 };
689         local_ret
690 }
691
692 /// A complete description of the purpose of the payment. Intended to be displayed to the user
693 /// but with the caveat that it has not been verified in any way.
694 #[must_use]
695 #[no_mangle]
696 pub extern "C" fn VerifiedInvoiceRequest_description(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
697         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.description();
698         crate::lightning::util::string::PrintableString { inner: ObjOps::heap_alloc(ret), is_owned: true }
699 }
700
701 /// Features pertaining to the offer.
702 #[must_use]
703 #[no_mangle]
704 pub extern "C" fn VerifiedInvoiceRequest_offer_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::OfferFeatures {
705         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.offer_features();
706         crate::lightning::ln::features::OfferFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::OfferFeatures<>) as *mut _) }, is_owned: false }
707 }
708
709 /// Duration since the Unix epoch when an invoice should no longer be requested.
710 ///
711 /// If `None`, the offer does not expire.
712 #[must_use]
713 #[no_mangle]
714 pub extern "C" fn VerifiedInvoiceRequest_absolute_expiry(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
715         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.absolute_expiry();
716         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() }) };
717         local_ret
718 }
719
720 /// The issuer of the offer, possibly beginning with `user@domain` or `domain`. Intended to be
721 /// displayed to the user but with the caveat that it has not been verified in any way.
722 ///
723 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
724 #[must_use]
725 #[no_mangle]
726 pub extern "C" fn VerifiedInvoiceRequest_issuer(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
727         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.issuer();
728         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 };
729         local_ret
730 }
731
732 /// Paths to the recipient originating from publicly reachable nodes. Blinded paths provide
733 /// recipient privacy by obfuscating its node id.
734 #[must_use]
735 #[no_mangle]
736 pub extern "C" fn VerifiedInvoiceRequest_paths(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::CVec_BlindedPathZ {
737         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.paths();
738         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 } }); };
739         local_ret.into()
740 }
741
742 /// The quantity of items supported.
743 #[must_use]
744 #[no_mangle]
745 pub extern "C" fn VerifiedInvoiceRequest_supported_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::offers::offer::Quantity {
746         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.supported_quantity();
747         crate::lightning::offers::offer::Quantity { inner: ObjOps::heap_alloc(ret), is_owned: true }
748 }
749
750 /// The public key used by the recipient to sign invoices.
751 #[must_use]
752 #[no_mangle]
753 pub extern "C" fn VerifiedInvoiceRequest_signing_pubkey(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey {
754         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.signing_pubkey();
755         crate::c_types::PublicKey::from_rust(&ret)
756 }
757
758 /// An unpredictable series of bytes, typically containing information about the derivation of
759 /// [`payer_id`].
760 ///
761 /// [`payer_id`]: Self::payer_id
762 #[must_use]
763 #[no_mangle]
764 pub extern "C" fn VerifiedInvoiceRequest_payer_metadata(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::u8slice {
765         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_metadata();
766         let mut local_ret = crate::c_types::u8slice::from_slice(ret);
767         local_ret
768 }
769
770 /// A chain from [`Offer::chains`] that the offer is valid for.
771 #[must_use]
772 #[no_mangle]
773 pub extern "C" fn VerifiedInvoiceRequest_chain(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::ThirtyTwoBytes {
774         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.chain();
775         crate::c_types::ThirtyTwoBytes { data: ret.to_bytes() }
776 }
777
778 /// The amount to pay in msats (i.e., the minimum lightning-payable unit for [`chain`]), which
779 /// must be greater than or equal to [`Offer::amount`], converted if necessary.
780 ///
781 /// [`chain`]: Self::chain
782 #[must_use]
783 #[no_mangle]
784 pub extern "C" fn VerifiedInvoiceRequest_amount_msats(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
785         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.amount_msats();
786         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() }) };
787         local_ret
788 }
789
790 /// Features pertaining to requesting an invoice.
791 #[must_use]
792 #[no_mangle]
793 pub extern "C" fn VerifiedInvoiceRequest_invoice_request_features(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::ln::features::InvoiceRequestFeatures {
794         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.invoice_request_features();
795         crate::lightning::ln::features::InvoiceRequestFeatures { inner: unsafe { ObjOps::nonnull_ptr_to_inner((ret as *const lightning::ln::features::InvoiceRequestFeatures<>) as *mut _) }, is_owned: false }
796 }
797
798 /// The quantity of the offer's item conforming to [`Offer::is_valid_quantity`].
799 #[must_use]
800 #[no_mangle]
801 pub extern "C" fn VerifiedInvoiceRequest_quantity(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::derived::COption_u64Z {
802         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.quantity();
803         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() }) };
804         local_ret
805 }
806
807 /// A possibly transient pubkey used to sign the invoice request.
808 #[must_use]
809 #[no_mangle]
810 pub extern "C" fn VerifiedInvoiceRequest_payer_id(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::c_types::PublicKey {
811         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_id();
812         crate::c_types::PublicKey::from_rust(&ret)
813 }
814
815 /// A payer-provided note which will be seen by the recipient and reflected back in the invoice
816 /// response.
817 ///
818 /// Note that the return value (or a relevant inner pointer) may be NULL or all-0s to represent None
819 #[must_use]
820 #[no_mangle]
821 pub extern "C" fn VerifiedInvoiceRequest_payer_note(this_arg: &crate::lightning::offers::invoice_request::VerifiedInvoiceRequest) -> crate::lightning::util::string::PrintableString {
822         let mut ret = unsafe { &*ObjOps::untweak_ptr(this_arg.inner) }.payer_note();
823         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 };
824         local_ret
825 }
826
827 #[no_mangle]
828 /// Serialize the UnsignedInvoiceRequest object into a byte array which can be read by UnsignedInvoiceRequest_read
829 pub extern "C" fn UnsignedInvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::UnsignedInvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
830         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
831 }
832 #[no_mangle]
833 pub(crate) extern "C" fn UnsignedInvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
834         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeUnsignedInvoiceRequest) })
835 }
836 #[no_mangle]
837 /// Serialize the InvoiceRequest object into a byte array which can be read by InvoiceRequest_read
838 pub extern "C" fn InvoiceRequest_write(obj: &crate::lightning::offers::invoice_request::InvoiceRequest) -> crate::c_types::derived::CVec_u8Z {
839         crate::c_types::serialize_obj(unsafe { &*obj }.get_native_ref())
840 }
841 #[no_mangle]
842 pub(crate) extern "C" fn InvoiceRequest_write_void(obj: *const c_void) -> crate::c_types::derived::CVec_u8Z {
843         crate::c_types::serialize_obj(unsafe { &*(obj as *const nativeInvoiceRequest) })
844 }