#![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};
#[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 StorageItemType(pub i32);
impl StorageItemType {
pub const kItemTypeBytestring: Self = Self(0);
pub const kItemTypeNonnegativeInt: Self = Self(1);
pub const kItemTypeRetrocausalQueue: Self = Self(2);
pub const kItemTypeReplayCacheData: Self = Self(3);
pub const kItemTypeAuthData: Self = Self(4);
pub const kItemTypeDeployedContractHash: Self = Self(5);
#[doc(hidden)]
pub const kItemTypeDeleted: Self = Self(-1);
}
impl From<i32> for StorageItemType {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "xdrs")]
impl xdrs::XDRDiscriminant for StorageItemType {
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 StorageItemType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kItemTypeBytestring.0 => {
f.write_str("StorageItemType::kItemTypeBytestring")
}
x if x == Self::kItemTypeNonnegativeInt.0 => {
f.write_str("StorageItemType::kItemTypeNonnegativeInt")
}
x if x == Self::kItemTypeRetrocausalQueue.0 => {
f.write_str("StorageItemType::kItemTypeRetrocausalQueue")
}
x if x == Self::kItemTypeReplayCacheData.0 => {
f.write_str("StorageItemType::kItemTypeReplayCacheData")
}
x if x == Self::kItemTypeAuthData.0 => {
f.write_str("StorageItemType::kItemTypeAuthData")
}
x if x == Self::kItemTypeDeployedContractHash.0 => {
f.write_str("StorageItemType::kItemTypeDeployedContractHash")
}
x if x == Self::kItemTypeDeleted.0 => {
f.write_str("StorageItemType::kItemTypeDeleted")
}
_ => write!(f, "StorageItemType({})", self.0),
}
}
}
pub const kBytestringCeilingLen: u32 = 65000;
pub const kDefaultMaxBytestringLen: u32 = 1024;
pub type Bytestring = BytesM<kBytestringCeilingLen>;
#[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 = "StorageItemType"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[repr(i32)]
#[non_exhaustive]
pub enum StorageItem {
kItemTypeBytestring {
bytestring: Bytestring,
} = StorageItemType::kItemTypeBytestring.0 as i32,
kItemTypeNonnegativeInt {
nnint: int128_xdr,
} = StorageItemType::kItemTypeNonnegativeInt.0 as i32,
kItemTypeRetrocausalQueue {
queue_entries: VecM<QueueEntry>,
} = StorageItemType::kItemTypeRetrocausalQueue.0 as i32,
kItemTypeReplayCacheData {
active_uniquifiers: VecM<Uniquifier>,
} = StorageItemType::kItemTypeReplayCacheData.0 as i32,
kItemTypeAuthData {
auth_data: AddressAuthData,
} = StorageItemType::kItemTypeAuthData.0 as i32,
kItemTypeDeployedContractHash {
deployed_contract_hash: DeployedContractHash,
} = StorageItemType::kItemTypeDeployedContractHash.0 as i32,
}
impl StorageItem {
#[allow(clippy::match_single_binding)]
pub fn r#type(&self) -> StorageItemType {
match self {
StorageItem::kItemTypeBytestring { .. } => {
StorageItemType::kItemTypeBytestring
}
StorageItem::kItemTypeNonnegativeInt { .. } => {
StorageItemType::kItemTypeNonnegativeInt
}
StorageItem::kItemTypeRetrocausalQueue { .. } => {
StorageItemType::kItemTypeRetrocausalQueue
}
StorageItem::kItemTypeReplayCacheData { .. } => {
StorageItemType::kItemTypeReplayCacheData
}
StorageItem::kItemTypeAuthData { .. } => StorageItemType::kItemTypeAuthData,
StorageItem::kItemTypeDeployedContractHash { .. } => {
StorageItemType::kItemTypeDeployedContractHash
}
}
}
}
#[doc(hidden)]
#[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 = "StorageItemType"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[repr(i32)]
#[non_exhaustive]
pub enum WireStorageItem {
kItemTypeBytestring {
bytestring: Bytestring,
} = StorageItemType::kItemTypeBytestring.0 as i32,
kItemTypeNonnegativeInt {
nnint: int128_xdr,
} = StorageItemType::kItemTypeNonnegativeInt.0 as i32,
kItemTypeAuthData {
auth_data: AddressAuthData,
} = StorageItemType::kItemTypeAuthData.0 as i32,
kItemTypeRetrocausalQueue {
metadata: RetrocausalQueueMetadata,
} = StorageItemType::kItemTypeRetrocausalQueue.0 as i32,
kItemTypeReplayCacheData = StorageItemType::kItemTypeReplayCacheData.0 as i32,
kItemTypeDeployedContractHash {
deployed_contract_hash: DeployedContractHash,
} = StorageItemType::kItemTypeDeployedContractHash.0 as i32,
}
impl WireStorageItem {
#[allow(clippy::match_single_binding)]
pub fn r#type(&self) -> StorageItemType {
match self {
WireStorageItem::kItemTypeBytestring { .. } => {
StorageItemType::kItemTypeBytestring
}
WireStorageItem::kItemTypeNonnegativeInt { .. } => {
StorageItemType::kItemTypeNonnegativeInt
}
WireStorageItem::kItemTypeAuthData { .. } => {
StorageItemType::kItemTypeAuthData
}
WireStorageItem::kItemTypeRetrocausalQueue { .. } => {
StorageItemType::kItemTypeRetrocausalQueue
}
WireStorageItem::kItemTypeReplayCacheData => {
StorageItemType::kItemTypeReplayCacheData
}
WireStorageItem::kItemTypeDeployedContractHash { .. } => {
StorageItemType::kItemTypeDeployedContractHash
}
}
}
}
#[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 StorageDeltaType(pub i32);
impl StorageDeltaType {
pub const kDeltaTypeBytestringSet: Self = Self(0);
pub const kDeltaTypeNonnegativeIntSetAdd: Self = Self(1);
pub const kDeltaTypeDelete: Self = Self(2);
pub const kDeltaTypeRetrocausalQueue: Self = Self(3);
pub const kDeltaTypeNonnegativeIntAdd: Self = Self(5);
pub const kDeltaTypeAuthDataChange: Self = Self(6);
pub const kDeltaTypeDeployContract: Self = Self(7);
pub const kDeltaTypeConsumeUniquifier: Self = Self(8);
}
impl From<i32> for StorageDeltaType {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "xdrs")]
impl xdrs::XDRDiscriminant for StorageDeltaType {
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 StorageDeltaType {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::kDeltaTypeBytestringSet.0 => {
f.write_str("StorageDeltaType::kDeltaTypeBytestringSet")
}
x if x == Self::kDeltaTypeNonnegativeIntSetAdd.0 => {
f.write_str("StorageDeltaType::kDeltaTypeNonnegativeIntSetAdd")
}
x if x == Self::kDeltaTypeDelete.0 => {
f.write_str("StorageDeltaType::kDeltaTypeDelete")
}
x if x == Self::kDeltaTypeRetrocausalQueue.0 => {
f.write_str("StorageDeltaType::kDeltaTypeRetrocausalQueue")
}
x if x == Self::kDeltaTypeNonnegativeIntAdd.0 => {
f.write_str("StorageDeltaType::kDeltaTypeNonnegativeIntAdd")
}
x if x == Self::kDeltaTypeAuthDataChange.0 => {
f.write_str("StorageDeltaType::kDeltaTypeAuthDataChange")
}
x if x == Self::kDeltaTypeDeployContract.0 => {
f.write_str("StorageDeltaType::kDeltaTypeDeployContract")
}
x if x == Self::kDeltaTypeConsumeUniquifier.0 => {
f.write_str("StorageDeltaType::kDeltaTypeConsumeUniquifier")
}
_ => write!(f, "StorageDeltaType({})", 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 AuthDataChangeSigner {
pub public_key_id: u32,
pub public_key: PublicKeyConfigOpt,
}
#[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 AuthDataChangeArgs {
pub auth_data_change_signers: VecM<AuthDataChangeSigner, kMaxSigners>,
pub new_required_weight: Option<Weight>,
}
#[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 NonnegativeInt128SetAddArgs {
pub set_value: int128_xdr,
pub add_value: int128_xdr,
}
#[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 ConsumeUniquifierArgs {
pub uniquifier: Uniquifier,
}
#[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 = "StorageDeltaType"))]
#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
#[repr(i32)]
#[non_exhaustive]
pub enum StorageDelta {
kDeltaTypeBytestringSet {
bytestring: Bytestring,
} = StorageDeltaType::kDeltaTypeBytestringSet.0 as i32,
kDeltaTypeNonnegativeIntSetAdd {
nnint: NonnegativeInt128SetAddArgs,
} = StorageDeltaType::kDeltaTypeNonnegativeIntSetAdd.0 as i32,
kDeltaTypeNonnegativeIntAdd {
nnint_add: int128_xdr,
} = StorageDeltaType::kDeltaTypeNonnegativeIntAdd.0 as i32,
kDeltaTypeDelete = StorageDeltaType::kDeltaTypeDelete.0 as i32,
kDeltaTypeRetrocausalQueue {
retrocausal_queue: RetrocausalQueueDelta,
} = StorageDeltaType::kDeltaTypeRetrocausalQueue.0 as i32,
kDeltaTypeAuthDataChange {
auth_data_change: AuthDataChangeArgs,
} = StorageDeltaType::kDeltaTypeAuthDataChange.0 as i32,
kDeltaTypeDeployContract {
deployed_contract_hash: DeployedContractHash,
} = StorageDeltaType::kDeltaTypeDeployContract.0 as i32,
kDeltaTypeConsumeUniquifier {
consume_uniquifier_args: ConsumeUniquifierArgs,
} = StorageDeltaType::kDeltaTypeConsumeUniquifier.0 as i32,
}
impl StorageDelta {
#[allow(clippy::match_single_binding)]
pub fn r#type(&self) -> StorageDeltaType {
match self {
StorageDelta::kDeltaTypeBytestringSet { .. } => {
StorageDeltaType::kDeltaTypeBytestringSet
}
StorageDelta::kDeltaTypeNonnegativeIntSetAdd { .. } => {
StorageDeltaType::kDeltaTypeNonnegativeIntSetAdd
}
StorageDelta::kDeltaTypeNonnegativeIntAdd { .. } => {
StorageDeltaType::kDeltaTypeNonnegativeIntAdd
}
StorageDelta::kDeltaTypeDelete => StorageDeltaType::kDeltaTypeDelete,
StorageDelta::kDeltaTypeRetrocausalQueue { .. } => {
StorageDeltaType::kDeltaTypeRetrocausalQueue
}
StorageDelta::kDeltaTypeAuthDataChange { .. } => {
StorageDeltaType::kDeltaTypeAuthDataChange
}
StorageDelta::kDeltaTypeDeployContract { .. } => {
StorageDeltaType::kDeltaTypeDeployContract
}
StorageDelta::kDeltaTypeConsumeUniquifier { .. } => {
StorageDeltaType::kDeltaTypeConsumeUniquifier
}
}
}
}
pub const kReplayCacheHeightsMaxLen: u32 = 4000;
pub const kReplayCacheNoncesMaxLen: u32 = 8000;
#[doc(hidden)]
#[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 ReplayCacheHeightCount {
pub height: BlockHeight,
pub nonce_count: u32,
}
#[doc(hidden)]
#[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 ReplayCacheMetadata {
pub size: i64,
pub heights: VecM<ReplayCacheHeightCount, kReplayCacheNoncesMaxLen>,
}
#[doc(hidden)]
#[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 ReplayCacheData {
pub nonces: VecM<u64, kReplayCacheNoncesMaxLen>,
}
#[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 StorageDeltaFlags(pub i32);
impl StorageDeltaFlags {
pub const None: Self = Self(0);
pub const ExclusiveLock: Self = Self(0x00000001);
}
impl From<i32> for StorageDeltaFlags {
fn from(v: i32) -> Self {
Self(v)
}
}
#[cfg(feature = "xdrs")]
impl xdrs::XDRDiscriminant for StorageDeltaFlags {
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 StorageDeltaFlags {
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
match self.0 {
x if x == Self::None.0 => f.write_str("StorageDeltaFlags::None"),
x if x == Self::ExclusiveLock.0 => {
f.write_str("StorageDeltaFlags::ExclusiveLock")
}
_ => write!(f, "StorageDeltaFlags({})", self.0),
}
}
}
pub type StorageDeltaFlagSet = u32;
#[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 FlaggedStorageDelta {
pub addrkey: AddressAndKey,
pub delta: StorageDelta,
pub flags: StorageDeltaFlagSet,
}