#[allow(unused_imports, clippy::wildcard_imports)]
use super::*;
#[cfg_attr(feature = "alloc", derive(Default))]
#[derive(Clone, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[cfg_attr(feature = "serde", cfg_eval::cfg_eval)]
#[cfg_attr(feature = "arbitrary", derive(Arbitrary))]
#[cfg_attr(
all(feature = "serde", feature = "alloc"),
serde_with::serde_as,
derive(serde::Serialize, serde::Deserialize),
serde(rename_all = "snake_case")
)]
#[cfg_attr(feature = "schemars", derive(schemars::JsonSchema))]
pub struct AccountEntry {
pub account_id: AccountId,
#[cfg_attr(
all(feature = "serde", feature = "alloc"),
serde_as(as = "NumberOrString")
)]
pub balance: i64,
pub seq_num: SequenceNumber,
pub num_sub_entries: u32,
pub inflation_dest: Option<AccountId>,
pub flags: u32,
pub home_domain: String32,
pub thresholds: Thresholds,
pub signers: VecM<Signer, 20>,
pub ext: AccountEntryExt,
}
impl ReadXdr for AccountEntry {
#[cfg(feature = "std")]
fn read_xdr<R: Read>(r: &mut Limited<R>) -> Result<Self, Error> {
r.with_limited_depth(|r| {
Ok(Self {
account_id: AccountId::read_xdr(r)?,
balance: i64::read_xdr(r)?,
seq_num: SequenceNumber::read_xdr(r)?,
num_sub_entries: u32::read_xdr(r)?,
inflation_dest: Option::<AccountId>::read_xdr(r)?,
flags: u32::read_xdr(r)?,
home_domain: String32::read_xdr(r)?,
thresholds: Thresholds::read_xdr(r)?,
signers: VecM::<Signer, 20>::read_xdr(r)?,
ext: AccountEntryExt::read_xdr(r)?,
})
})
}
}
impl WriteXdr for AccountEntry {
#[cfg(feature = "std")]
fn write_xdr<W: Write>(&self, w: &mut Limited<W>) -> Result<(), Error> {
w.with_limited_depth(|w| {
self.account_id.write_xdr(w)?;
self.balance.write_xdr(w)?;
self.seq_num.write_xdr(w)?;
self.num_sub_entries.write_xdr(w)?;
self.inflation_dest.write_xdr(w)?;
self.flags.write_xdr(w)?;
self.home_domain.write_xdr(w)?;
self.thresholds.write_xdr(w)?;
self.signers.write_xdr(w)?;
self.ext.write_xdr(w)?;
Ok(())
})
}
}