use derive_more::From;
pub type BlockNumber = u32;
pub type BlockTimestamp = u64;
pub type Balance = u128;
#[derive(Debug, From, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct AccountId(Vec<u8>);
impl AccountId {
pub fn from_bytes(bytes: &[u8]) -> Self {
Self(bytes.to_vec())
}
pub fn as_bytes(&self) -> &[u8] {
&self.0[..]
}
}
#[derive(Default, From, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[repr(transparent)]
pub struct Key(Vec<u8>);
impl Key {
#[allow(dead_code)]
pub fn from_bytes(bytes: &[u8]) -> Self {
Self(bytes.to_vec())
}
}
#[derive(Clone, Debug, From, PartialEq, Eq)]
pub enum AccountError {
Decoding(scale::Error),
#[from(ignore)]
UnexpectedUserAccount,
#[from(ignore)]
NoAccountForId(Vec<u8>),
}