#![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::ops::{Deref, DerefMut};
use core::option::Option;
#[cfg(feature = "std")]
use std::io::{Read, Write};
#[cfg(feature = "xdrs")]
use xdrs::*;
#[cfg(feature = "serde")]
use ::serde::{Deserialize, Serialize};
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 = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[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 = "xdrs")]
impl xdrs::XDRDiscriminant for AuthClaimType {
const ENCODING: xdrs::DiscriminantEncoding = xdrs::DiscriminantEncoding::Signed;
fn discriminant(&self) -> i32 {
self.0
}
fn from_discriminant(d: i32) -> Self {
Self(d)
}
}
#[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 => {
f.write_str("AuthClaimType::kSourceAddressAuthData")
}
x if x == Self::kPubkeySignature.0 => {
f.write_str("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 = "xdrs", xdr(discriminant = "AuthClaimType"))]
#[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,
}
impl AuthClaim {
#[allow(clippy::match_single_binding)]
pub fn claim_type(&self) -> AuthClaimType {
match self {
AuthClaim::kSourceAddressAuthData { .. } => {
AuthClaimType::kSourceAddressAuthData
}
AuthClaim::kPubkeySignature { .. } => AuthClaimType::kPubkeySignature,
}
}
}
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
#[cfg_attr(feature = "serde", serde(transparent))]
#[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 = "xdrs")]
impl xdrs::XDRDiscriminant for AuthVerifyErrorCode {
const ENCODING: xdrs::DiscriminantEncoding = xdrs::DiscriminantEncoding::Signed;
fn discriminant(&self) -> i32 {
self.0
}
fn from_discriminant(d: i32) -> Self {
Self(d)
}
}
#[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 => {
f.write_str("AuthVerifyErrorCode::kAuthMalformed")
}
x if x == Self::kSignatureVerificationFailed.0 => {
f.write_str("AuthVerifyErrorCode::kSignatureVerificationFailed")
}
x if x == Self::kAuthDataMismatch.0 => {
f.write_str("AuthVerifyErrorCode::kAuthDataMismatch")
}
_ => write!(f, "AuthVerifyErrorCode({})", self.0),
}
}
}