1#![allow(non_camel_case_types)]
7#![allow(non_snake_case)]
8#![allow(non_upper_case_globals)]
9#![allow(unused_imports)]
10#![allow(dead_code)]
11#![allow(unused_variables)]
12#![allow(clippy::unnecessary_cast)]
13
14use crate::*;
15use core::option::Option;
16use core::ops::{Deref, DerefMut};
17
18#[cfg(feature = "std")]
19use std::io::{Read, Write};
20#[cfg(feature = "xdrs")]
21use xdrs::*;
22
23
24#[cfg(feature = "serde")]
25use ::serde::{{Serialize, Deserialize}};
26
27
28
29#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
31#[cfg_attr(feature = "serde", serde(transparent))]
32#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
33#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
34#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
35#[derive(Copy)]
36#[repr(transparent)]
37pub struct StorageItemType(pub i32);
38
39impl StorageItemType {
40 pub const kItemTypeBytestring: Self = Self(0);
41 pub const kItemTypeNonnegativeInt: Self = Self(1);
42 pub const kItemTypeRetrocausalQueue: Self = Self(2);
43 pub const kItemTypeReplayCacheData: Self = Self(3);
44 pub const kItemTypeAuthData: Self = Self(4);
45 pub const kItemTypeDeployedContractHash: Self = Self(5);
46
47 #[doc(hidden)]pub const kItemTypeDeleted: Self = Self(-1);
51}
52impl From<i32> for StorageItemType {
53 fn from(v: i32) -> Self {
54 Self(v)
55 }
56}
57#[cfg(feature = "std")]
58impl core::fmt::Display for StorageItemType {
59 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
60 match self.0 {
61 x if x == Self::kItemTypeBytestring.0 => {
62 write!(f, "StorageItemType::kItemTypeBytestring")
63 },
64 x if x == Self::kItemTypeNonnegativeInt.0 => {
65 write!(f, "StorageItemType::kItemTypeNonnegativeInt")
66 },
67 x if x == Self::kItemTypeRetrocausalQueue.0 => {
68 write!(f, "StorageItemType::kItemTypeRetrocausalQueue")
69 },
70 x if x == Self::kItemTypeReplayCacheData.0 => {
71 write!(f, "StorageItemType::kItemTypeReplayCacheData")
72 },
73 x if x == Self::kItemTypeAuthData.0 => {
74 write!(f, "StorageItemType::kItemTypeAuthData")
75 },
76 x if x == Self::kItemTypeDeployedContractHash.0 => {
77 write!(f, "StorageItemType::kItemTypeDeployedContractHash")
78 },
79 x if x == Self::kItemTypeDeleted.0 => {
80 write!(f, "StorageItemType::kItemTypeDeleted")
81 },
82 _ => {
83 write!(f, "StorageItemType({})", self.0)
84 }
85 }
86 }
87}
88
89
90pub const kBytestringCeilingLen : u32 = 65000;
94
95pub const kDefaultMaxBytestringLen : u32 = 1024;
97
98pub type Bytestring = BytesM::<kBytestringCeilingLen>;
103
104#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
113#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
114#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
115#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
116#[repr(i32)]
117#[non_exhaustive]
118pub enum StorageItem {
119 kItemTypeBytestring { bytestring: Bytestring } = StorageItemType::kItemTypeBytestring.0 as i32,
123 kItemTypeNonnegativeInt { nnint: int128_xdr } = StorageItemType::kItemTypeNonnegativeInt.0 as i32,
131 kItemTypeRetrocausalQueue { queue_entries: VecM<QueueEntry> } = StorageItemType::kItemTypeRetrocausalQueue.0 as i32,
137 kItemTypeReplayCacheData { active_uniquifiers: VecM<Uniquifier> } = StorageItemType::kItemTypeReplayCacheData.0 as i32,
145 kItemTypeAuthData { auth_data: AddressAuthData } = StorageItemType::kItemTypeAuthData.0 as i32,
152 kItemTypeDeployedContractHash { deployed_contract_hash: DeployedContractHash } = StorageItemType::kItemTypeDeployedContractHash.0 as i32,
159
160}
161#[doc(hidden)]
169#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
170#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
171#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
172#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
173#[repr(i32)]
174#[non_exhaustive]
175pub enum WireStorageItem {
176 kItemTypeBytestring { bytestring: Bytestring } = StorageItemType::kItemTypeBytestring.0 as i32,
179 kItemTypeNonnegativeInt { nnint: int128_xdr } = StorageItemType::kItemTypeNonnegativeInt.0 as i32,
182 kItemTypeAuthData { auth_data: AddressAuthData } = StorageItemType::kItemTypeAuthData.0 as i32,
185 kItemTypeRetrocausalQueue { metadata: RetrocausalQueueMetadata } = StorageItemType::kItemTypeRetrocausalQueue.0 as i32,
188 kItemTypeReplayCacheData = StorageItemType::kItemTypeReplayCacheData.0 as i32,
191 kItemTypeDeployedContractHash { deployed_contract_hash: DeployedContractHash } = StorageItemType::kItemTypeDeployedContractHash.0 as i32,
194
195}
196
197#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
200#[cfg_attr(feature = "serde", serde(transparent))]
201#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
202#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
203#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
204#[derive(Copy)]
205#[repr(transparent)]
206pub struct StorageDeltaType(pub i32);
207
208impl StorageDeltaType {
209 pub const kDeltaTypeBytestringSet: Self = Self(0);
210 pub const kDeltaTypeNonnegativeIntSetAdd: Self = Self(1);
211 pub const kDeltaTypeDelete: Self = Self(2);
212 pub const kDeltaTypeRetrocausalQueue: Self = Self(3);
213 pub const kDeltaTypeNonnegativeIntAdd: Self = Self(5);
214 pub const kDeltaTypeAuthDataChange: Self = Self(6);
215 pub const kDeltaTypeDeployContract: Self = Self(7);
216 pub const kDeltaTypeConsumeUniquifier: Self = Self(8);
217}
218impl From<i32> for StorageDeltaType {
219 fn from(v: i32) -> Self {
220 Self(v)
221 }
222}
223#[cfg(feature = "std")]
224impl core::fmt::Display for StorageDeltaType {
225 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
226 match self.0 {
227 x if x == Self::kDeltaTypeBytestringSet.0 => {
228 write!(f, "StorageDeltaType::kDeltaTypeBytestringSet")
229 },
230 x if x == Self::kDeltaTypeNonnegativeIntSetAdd.0 => {
231 write!(f, "StorageDeltaType::kDeltaTypeNonnegativeIntSetAdd")
232 },
233 x if x == Self::kDeltaTypeDelete.0 => {
234 write!(f, "StorageDeltaType::kDeltaTypeDelete")
235 },
236 x if x == Self::kDeltaTypeRetrocausalQueue.0 => {
237 write!(f, "StorageDeltaType::kDeltaTypeRetrocausalQueue")
238 },
239 x if x == Self::kDeltaTypeNonnegativeIntAdd.0 => {
240 write!(f, "StorageDeltaType::kDeltaTypeNonnegativeIntAdd")
241 },
242 x if x == Self::kDeltaTypeAuthDataChange.0 => {
243 write!(f, "StorageDeltaType::kDeltaTypeAuthDataChange")
244 },
245 x if x == Self::kDeltaTypeDeployContract.0 => {
246 write!(f, "StorageDeltaType::kDeltaTypeDeployContract")
247 },
248 x if x == Self::kDeltaTypeConsumeUniquifier.0 => {
249 write!(f, "StorageDeltaType::kDeltaTypeConsumeUniquifier")
250 },
251 _ => {
252 write!(f, "StorageDeltaType({})", self.0)
253 }
254 }
255 }
256}
257
258
259#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
260#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
261#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
262#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
263#[repr(C)]
264pub struct AuthDataChangeSigner {
265 pub public_key_id: u32,
266 pub public_key: PublicKeyConfigOpt,
267}
268
269#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
270#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
271#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
272#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
273#[repr(C)]
274pub struct AuthDataChangeArgs {
275 pub auth_data_change_signers: VecM<AuthDataChangeSigner, kMaxSigners>,
276 pub new_required_weight: Option<Weight>,
277}
278
279#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
280#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
281#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
282#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
283#[repr(C)]
284pub struct NonnegativeInt128SetAddArgs {
285 pub set_value: int128_xdr,
286 pub add_value: int128_xdr,
287}
288
289#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
290#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
291#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
292#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
293#[repr(C)]
294pub struct ConsumeUniquifierArgs {
295 pub uniquifier: Uniquifier,
296}
297
298#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
309#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
310#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
311#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
312#[repr(i32)]
313#[non_exhaustive]
314pub enum StorageDelta {
315 kDeltaTypeBytestringSet { bytestring: Bytestring } = StorageDeltaType::kDeltaTypeBytestringSet.0 as i32,
324 kDeltaTypeNonnegativeIntSetAdd { nnint: NonnegativeInt128SetAddArgs } = StorageDeltaType::kDeltaTypeNonnegativeIntSetAdd.0 as i32,
341 kDeltaTypeNonnegativeIntAdd { nnint_add: int128_xdr } = StorageDeltaType::kDeltaTypeNonnegativeIntAdd.0 as i32,
353 kDeltaTypeDelete = StorageDeltaType::kDeltaTypeDelete.0 as i32,
362 kDeltaTypeRetrocausalQueue { retrocausal_queue: RetrocausalQueueDelta } = StorageDeltaType::kDeltaTypeRetrocausalQueue.0 as i32,
373 kDeltaTypeAuthDataChange { auth_data_change: AuthDataChangeArgs } = StorageDeltaType::kDeltaTypeAuthDataChange.0 as i32,
382 kDeltaTypeDeployContract { deployed_contract_hash: DeployedContractHash } = StorageDeltaType::kDeltaTypeDeployContract.0 as i32,
393 kDeltaTypeConsumeUniquifier { consume_uniquifier_args: ConsumeUniquifierArgs } = StorageDeltaType::kDeltaTypeConsumeUniquifier.0 as i32,
402
403}
404
405pub const kReplayCacheHeightsMaxLen : u32 = 4000;
407
408pub const kReplayCacheNoncesMaxLen : u32 = 8000;
410#[doc(hidden)]
417#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
418#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
419#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
420#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
421#[repr(C)]
422pub struct ReplayCacheHeightCount {
423 pub height: BlockHeight,
424 pub nonce_count: u32,
425}
426#[doc(hidden)]
429#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
430#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
431#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
432#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
433#[repr(C)]
434pub struct ReplayCacheMetadata {
435 pub size: i64,
437 pub heights: VecM<ReplayCacheHeightCount, kReplayCacheNoncesMaxLen>,
439}
440#[doc(hidden)]
443#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
444#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
445#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
446#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
447#[repr(C)]
448pub struct ReplayCacheData {
449 pub nonces: VecM<u64, kReplayCacheNoncesMaxLen>,
451}
452
453#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
456#[cfg_attr(feature = "serde", serde(transparent))]
457#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
458#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
459#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
460#[derive(Copy)]
461#[repr(transparent)]
462pub struct StorageDeltaFlags(pub i32);
463
464impl StorageDeltaFlags {
465 pub const None: Self = Self(0);
466
467 pub const ExclusiveLock: Self = Self(0x00000001);
470}
471impl From<i32> for StorageDeltaFlags {
472 fn from(v: i32) -> Self {
473 Self(v)
474 }
475}
476#[cfg(feature = "std")]
477impl core::fmt::Display for StorageDeltaFlags {
478 fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
479 match self.0 {
480 x if x == Self::None.0 => {
481 write!(f, "StorageDeltaFlags::None")
482 },
483 x if x == Self::ExclusiveLock.0 => {
484 write!(f, "StorageDeltaFlags::ExclusiveLock")
485 },
486 _ => {
487 write!(f, "StorageDeltaFlags({})", self.0)
488 }
489 }
490 }
491}
492
493
494pub type StorageDeltaFlagSet = u32;
499
500#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
503#[cfg_attr(feature = "xdrs", derive(ReadXDR, WriteXDR, ConstXDRSize))]
504#[cfg_attr(feature = "schema", derive(schemars::JsonSchema))]
505#[derive(Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
506#[repr(C)]
507pub struct FlaggedStorageDelta {
508 pub addrkey: AddressAndKey,
513 pub delta: StorageDelta,
514 pub flags: StorageDeltaFlagSet,
515}
516
517
518impl StorageItem {
523 #[allow(clippy::match_single_binding)]
524 pub fn r#type(&self) -> StorageItemType {
525 match self {
526
527 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
528 }
529 }
530}
531
532impl WireStorageItem {
533 #[allow(clippy::match_single_binding)]
534 pub fn r#type(&self) -> StorageItemType {
535 match self {
536
537 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
538 }
539 }
540}
541
542impl StorageDelta {
543 #[allow(clippy::match_single_binding)]
544 pub fn r#type(&self) -> StorageDeltaType {
545 match self {
546
547 _ => (unsafe { *(self as *const Self as *const i32) }).into(),
548 }
549 }
550}
551
552