pub struct AccountView {
pub amount: NearToken,
pub locked: NearToken,
pub code_hash: CryptoHash,
pub storage_usage: u64,
pub storage_paid_at: u64,
pub global_contract_hash: Option<CryptoHash>,
pub global_contract_account_id: Option<AccountId>,
pub block_height: u64,
pub block_hash: CryptoHash,
}Expand description
Account information from view_account RPC.
Fields§
§amount: NearTokenTotal balance including locked.
locked: NearTokenLocked balance (staked).
code_hash: CryptoHashHash of deployed contract code (or zeros if none).
storage_usage: u64Storage used in bytes.
storage_paid_at: u64Storage paid at block height (deprecated, always 0).
global_contract_hash: Option<CryptoHash>Global contract code hash (if using a global contract).
global_contract_account_id: Option<AccountId>Global contract account ID (if using a global contract by account).
block_height: u64Block height of the query.
block_hash: CryptoHashBlock hash of the query.
Implementations§
Source§impl AccountView
impl AccountView
Sourcepub fn available(&self) -> NearToken
pub fn available(&self) -> NearToken
Get available (spendable) balance.
This accounts for the protocol rule that staked tokens count towards the storage requirement:
- available = amount - max(0, storage_required - locked)
If staked >= storage cost, all liquid balance is available. If staked < storage cost, some liquid balance is reserved for storage.
Sourcepub fn storage_cost(&self) -> NearToken
pub fn storage_cost(&self) -> NearToken
Get the amount of NEAR reserved for storage costs.
This is calculated as: max(0, storage_required - locked)
Sourcepub fn has_contract(&self) -> bool
pub fn has_contract(&self) -> bool
Check if this account has a deployed contract.
Trait Implementations§
Source§impl Clone for AccountView
impl Clone for AccountView
Source§fn clone(&self) -> AccountView
fn clone(&self) -> AccountView
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more