pub struct SpotAccount {
pub id: Vec<u8>,
pub cid: Vec<u8>,
pub balances: HashMap<Vec<u8>, u64>,
pub state_hash: Vec<u8>,
}Fields§
§id: Vec<u8>Account ID
cid: Vec<u8>client id
balances: HashMap<Vec<u8>, u64>Balances of the account with asset id as key and balance as value
state_hash: Vec<u8>state hash of the account
Implementations§
Source§impl SpotAccount
impl SpotAccount
pub fn new(id: impl Into<Vec<u8>>, cid: impl Into<Vec<u8>>) -> Self
pub fn deposit(&mut self, asset: impl Into<Vec<u8>>, amount: u64)
pub fn withdraw(&mut self, asset: impl Into<Vec<u8>>, amount: u64)
pub fn transfer( &mut self, asset: impl Into<Vec<u8>>, _from: impl Into<Vec<u8>>, to: impl Into<Vec<u8>>, amount: u64, ) -> Result<(), SpotAccountError>
pub fn update_state_hash(&mut self)
pub fn hash_state(&self) -> Vec<u8> ⓘ
Trait Implementations§
Source§impl Clone for SpotAccount
impl Clone for SpotAccount
Source§impl Debug for SpotAccount
impl Debug for SpotAccount
Source§impl Default for SpotAccount
impl Default for SpotAccount
Source§impl<'de> Deserialize<'de> for SpotAccount
impl<'de> Deserialize<'de> for SpotAccount
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for SpotAccount
Source§impl PartialEq for SpotAccount
impl PartialEq for SpotAccount
Source§impl Serialize for SpotAccount
impl Serialize for SpotAccount
impl StructuralPartialEq for SpotAccount
Auto Trait Implementations§
impl Forget for SpotAccount
impl Freeze for SpotAccount
impl RefUnwindSafe for SpotAccount
impl Send for SpotAccount
impl Sync for SpotAccount
impl Unpin for SpotAccount
impl UnsafeUnpin for SpotAccount
impl UnwindSafe for SpotAccount
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more