Update autogenerated bindings to latest LDK 0.0.123-bindings
[ldk-c-bindings] / lightning-c-bindings / src / lightning / offers / parse.rs
index 7730cc13d1d1fc108983c288cd7bc7844bb40220..34920bc2a4d66e5725b60d3a34c7ab33b7198ff8 100644 (file)
@@ -9,6 +9,7 @@
 //! Parsing and formatting for bech32 message encoding.
 
 use alloc::str::FromStr;
+use alloc::string::String;
 use core::ffi::c_void;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
@@ -19,6 +20,7 @@ use alloc::{vec::Vec, boxed::Box};
 mod sealed {
 
 use alloc::str::FromStr;
+use alloc::string::String;
 use core::ffi::c_void;
 use core::convert::Infallible;
 use bitcoin::hashes::Hash;
@@ -90,13 +92,16 @@ impl Clone for Bolt12ParseError {
 #[allow(unused)]
 /// Used only if an object of this type is returned as a trait impl by a method
 pub(crate) extern "C" fn Bolt12ParseError_clone_void(this_ptr: *const c_void) -> *mut c_void {
-       Box::into_raw(Box::new(unsafe { (*(this_ptr as *mut nativeBolt12ParseError)).clone() })) as *mut c_void
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const nativeBolt12ParseError)).clone() })) as *mut c_void
 }
 #[no_mangle]
 /// Creates a copy of the Bolt12ParseError
 pub extern "C" fn Bolt12ParseError_clone(orig: &Bolt12ParseError) -> Bolt12ParseError {
        orig.clone()
 }
+/// Get a string which allows debug introspection of a Bolt12ParseError object
+pub extern "C" fn Bolt12ParseError_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12ParseError }).into()}
 /// Error when interpreting a TLV stream as a specific type.
 #[derive(Clone)]
 #[must_use]
@@ -144,8 +149,12 @@ pub enum Bolt12SemanticError {
        MissingPayerMetadata,
        /// A payer id was expected but was missing.
        MissingPayerId,
+       /// The payment id for a refund or request is already in use.
+       DuplicatePaymentId,
        /// Blinded paths were expected but were missing.
        MissingPaths,
+       /// Blinded paths were provided but were not expected.
+       UnexpectedPaths,
        /// The blinded payinfo given does not match the number of blinded path hops.
        InvalidPayInfo,
        /// An invoice creation time was expected but was missing.
@@ -183,7 +192,9 @@ impl Bolt12SemanticError {
                        Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
                        Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
                        Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
+                       Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
                        Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
+                       Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths,
                        Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
                        Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
                        Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash,
@@ -214,7 +225,9 @@ impl Bolt12SemanticError {
                        Bolt12SemanticError::UnexpectedMetadata => nativeBolt12SemanticError::UnexpectedMetadata,
                        Bolt12SemanticError::MissingPayerMetadata => nativeBolt12SemanticError::MissingPayerMetadata,
                        Bolt12SemanticError::MissingPayerId => nativeBolt12SemanticError::MissingPayerId,
+                       Bolt12SemanticError::DuplicatePaymentId => nativeBolt12SemanticError::DuplicatePaymentId,
                        Bolt12SemanticError::MissingPaths => nativeBolt12SemanticError::MissingPaths,
+                       Bolt12SemanticError::UnexpectedPaths => nativeBolt12SemanticError::UnexpectedPaths,
                        Bolt12SemanticError::InvalidPayInfo => nativeBolt12SemanticError::InvalidPayInfo,
                        Bolt12SemanticError::MissingCreationTime => nativeBolt12SemanticError::MissingCreationTime,
                        Bolt12SemanticError::MissingPaymentHash => nativeBolt12SemanticError::MissingPaymentHash,
@@ -222,7 +235,8 @@ impl Bolt12SemanticError {
                }
        }
        #[allow(unused)]
-       pub(crate) fn from_native(native: &nativeBolt12SemanticError) -> Self {
+       pub(crate) fn from_native(native: &Bolt12SemanticErrorImport) -> Self {
+               let native = unsafe { &*(native as *const _ as *const c_void as *const nativeBolt12SemanticError) };
                match native {
                        nativeBolt12SemanticError::AlreadyExpired => Bolt12SemanticError::AlreadyExpired,
                        nativeBolt12SemanticError::UnsupportedChain => Bolt12SemanticError::UnsupportedChain,
@@ -245,7 +259,9 @@ impl Bolt12SemanticError {
                        nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
                        nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
                        nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
+                       nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
                        nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
+                       nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths,
                        nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
                        nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
                        nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash,
@@ -276,7 +292,9 @@ impl Bolt12SemanticError {
                        nativeBolt12SemanticError::UnexpectedMetadata => Bolt12SemanticError::UnexpectedMetadata,
                        nativeBolt12SemanticError::MissingPayerMetadata => Bolt12SemanticError::MissingPayerMetadata,
                        nativeBolt12SemanticError::MissingPayerId => Bolt12SemanticError::MissingPayerId,
+                       nativeBolt12SemanticError::DuplicatePaymentId => Bolt12SemanticError::DuplicatePaymentId,
                        nativeBolt12SemanticError::MissingPaths => Bolt12SemanticError::MissingPaths,
+                       nativeBolt12SemanticError::UnexpectedPaths => Bolt12SemanticError::UnexpectedPaths,
                        nativeBolt12SemanticError::InvalidPayInfo => Bolt12SemanticError::InvalidPayInfo,
                        nativeBolt12SemanticError::MissingCreationTime => Bolt12SemanticError::MissingCreationTime,
                        nativeBolt12SemanticError::MissingPaymentHash => Bolt12SemanticError::MissingPaymentHash,
@@ -289,6 +307,16 @@ impl Bolt12SemanticError {
 pub extern "C" fn Bolt12SemanticError_clone(orig: &Bolt12SemanticError) -> Bolt12SemanticError {
        orig.clone()
 }
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12SemanticError_clone_void(this_ptr: *const c_void) -> *mut c_void {
+       Box::into_raw(Box::new(unsafe { (*(this_ptr as *const Bolt12SemanticError)).clone() })) as *mut c_void
+}
+#[allow(unused)]
+/// Used only if an object of this type is returned as a trait impl by a method
+pub(crate) extern "C" fn Bolt12SemanticError_free_void(this_ptr: *mut c_void) {
+       let _ = unsafe { Box::from_raw(this_ptr as *mut Bolt12SemanticError) };
+}
 #[no_mangle]
 /// Utility method to constructs a new AlreadyExpired-variant Bolt12SemanticError
 pub extern "C" fn Bolt12SemanticError_already_expired() -> Bolt12SemanticError {
@@ -374,10 +402,18 @@ pub extern "C" fn Bolt12SemanticError_missing_payer_metadata() -> Bolt12Semantic
 pub extern "C" fn Bolt12SemanticError_missing_payer_id() -> Bolt12SemanticError {
        Bolt12SemanticError::MissingPayerId}
 #[no_mangle]
+/// Utility method to constructs a new DuplicatePaymentId-variant Bolt12SemanticError
+pub extern "C" fn Bolt12SemanticError_duplicate_payment_id() -> Bolt12SemanticError {
+       Bolt12SemanticError::DuplicatePaymentId}
+#[no_mangle]
 /// Utility method to constructs a new MissingPaths-variant Bolt12SemanticError
 pub extern "C" fn Bolt12SemanticError_missing_paths() -> Bolt12SemanticError {
        Bolt12SemanticError::MissingPaths}
 #[no_mangle]
+/// Utility method to constructs a new UnexpectedPaths-variant Bolt12SemanticError
+pub extern "C" fn Bolt12SemanticError_unexpected_paths() -> Bolt12SemanticError {
+       Bolt12SemanticError::UnexpectedPaths}
+#[no_mangle]
 /// Utility method to constructs a new InvalidPayInfo-variant Bolt12SemanticError
 pub extern "C" fn Bolt12SemanticError_invalid_pay_info() -> Bolt12SemanticError {
        Bolt12SemanticError::InvalidPayInfo}
@@ -393,3 +429,6 @@ pub extern "C" fn Bolt12SemanticError_missing_payment_hash() -> Bolt12SemanticEr
 /// Utility method to constructs a new MissingSignature-variant Bolt12SemanticError
 pub extern "C" fn Bolt12SemanticError_missing_signature() -> Bolt12SemanticError {
        Bolt12SemanticError::MissingSignature}
+/// Get a string which allows debug introspection of a Bolt12SemanticError object
+pub extern "C" fn Bolt12SemanticError_debug_str_void(o: *const c_void) -> Str {
+       alloc::format!("{:?}", unsafe { o as *const crate::lightning::offers::parse::Bolt12SemanticError }).into()}