mirror of
https://github.com/logos-blockchain/lssa.git
synced 2026-01-04 06:13:10 +00:00
fix: docs added
This commit is contained in:
parent
5f4d6c0f8d
commit
a24a40f4bc
@ -2,8 +2,9 @@ use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize, Clone)]
|
||||
///Helperstruct for account serialization
|
||||
pub struct AccountInitialData {
|
||||
///Hex encoded AccountAddress
|
||||
///Hex encoded `AccountAddress`
|
||||
pub addr: String,
|
||||
pub balance: u64,
|
||||
}
|
||||
|
||||
@ -40,19 +40,27 @@ impl SequencerAccountsStore {
|
||||
Self { accounts }
|
||||
}
|
||||
|
||||
///Register new account in accounts store
|
||||
///
|
||||
///Starts with zero public balance
|
||||
pub fn register_account(&mut self, account_addr: AccountAddress) {
|
||||
self.accounts
|
||||
.insert(account_addr, AccountPublicData::new(account_addr));
|
||||
}
|
||||
|
||||
///Check, if `account_addr` present in account store
|
||||
pub fn contains_account(&self, account_addr: &AccountAddress) -> bool {
|
||||
self.accounts.contains_key(account_addr)
|
||||
}
|
||||
|
||||
///Check `account_addr` balance,
|
||||
///
|
||||
///returns `None`, if account address not found
|
||||
pub fn get_account_balance(&self, account_addr: &AccountAddress) -> Option<u64> {
|
||||
self.accounts.get(account_addr).map(|acc| acc.balance)
|
||||
}
|
||||
|
||||
///Remove account from storage
|
||||
pub fn unregister_account(&mut self, account_addr: AccountAddress) {
|
||||
self.accounts.remove(&account_addr);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user