#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(non_upper_case_globals)]
#![allow(unused_imports)]
#![allow(dead_code)]
#![allow(unused_variables)]
#![allow(clippy::unnecessary_cast)]
use crate::*;
use core::option::Option;
use core::ops::{Deref, DerefMut};
#[cfg(feature = "std")]
use std::io::{Read, Write};
#[cfg(feature = "xdrs")]
use xdrs::*;
#[cfg(feature = "serde")]
use ::serde::{{Serialize, Deserialize}};
pub type Weight = u32;
pub type BitMap = u32;
pub type KeyID = u32;
pub const kMaxSigners : u32 = 21;
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct AuthClaimType(pub i32);
impl AuthClaimType {
pub const kSourceAddressAuthData: Self = Self(0);
pub const kPubkeySignature: Self = Self(1);
}
impl From<i32> for AuthClaimType {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for AuthClaimType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kSourceAddressAuthData.0 => {
write!(f, "AuthClaimType::kSourceAddressAuthData")
},
x if x == Self::kPubkeySignature.0 => {
write!(f, "AuthClaimType::kPubkeySignature")
},
_ => {
write!(f, "AuthClaimType({})", self.0)
}
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct PubkeyAccountPreimage {
pub pubkey_hash: PublicKeyHash,
pub nonce: u64,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[repr(C)]
pub struct AuthClaim_source_address_claim {
pub allowed_keys: BitMap,
pub required_weight: Weight,
}
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[repr(i32)]
#[non_exhaustive]
pub enum AuthClaim {
kSourceAddressAuthData { source_address_claim: AuthClaim_source_address_claim } = AuthClaimType::kSourceAddressAuthData.0 as i32,
kPubkeySignature { pubkey_preimage: PubkeyAccountPreimage } = AuthClaimType::kPubkeySignature.0 as i32,
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
#[derive(Copy)]
#[repr(transparent)]
pub struct AuthVerifyErrorCode(pub i32);
impl AuthVerifyErrorCode {
pub const kAuthMalformed: Self = Self(1);
pub const kSignatureVerificationFailed: Self = Self(2);
pub const kAuthDataMismatch: Self = Self(3);
}
impl From<i32> for AuthVerifyErrorCode {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "std")]
impl core::fmt::Display for AuthVerifyErrorCode {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kAuthMalformed.0 => {
write!(f, "AuthVerifyErrorCode::kAuthMalformed")
},
x if x == Self::kSignatureVerificationFailed.0 => {
write!(f, "AuthVerifyErrorCode::kSignatureVerificationFailed")
},
x if x == Self::kAuthDataMismatch.0 => {
write!(f, "AuthVerifyErrorCode::kAuthDataMismatch")
},
_ => {
write!(f, "AuthVerifyErrorCode({})", self.0)
}
}
}
}
impl AuthClaim {
#[allow(clippy::match_single_binding)]
pub fn claim_type(&self) -> AuthClaimType {
match self {
_ => (unsafe { *(self as *const Self as *const i32) }).into(),
}
}
}