#[repr(C)]pub struct Account {
pub mint: Pubkey,
pub owner: Pubkey,
pub amount: u64,
pub delegate: COption<Pubkey>,
pub state: AccountState,
pub is_native: COption<u64>,
pub delegated_amount: u64,
pub close_authority: COption<Pubkey>,
}
Expand description
Account data.
Fields
mint: Pubkey
The mint associated with this account
owner: Pubkey
The owner of this account.
amount: u64
The amount of tokens this account holds.
delegate: COption<Pubkey>
If delegate
is Some
then delegated_amount
represents
the amount authorized by the delegate
state: AccountState
The account’s state
is_native: COption<u64>
If is_native.is_some, this is a native token, and the value logs the rent-exempt reserve. An Account is required to be rent-exempt, so the value is used by the Processor to ensure that wrapped SOL accounts do not drop below this threshold.
delegated_amount: u64
The amount delegated
Optional authority to close the account.
Implementations
Trait Implementations
sourceimpl GenericTokenAccount for Account
impl GenericTokenAccount for Account
sourcefn valid_account_data(account_data: &[u8]) -> bool
fn valid_account_data(account_data: &[u8]) -> bool
Check if the account data is a valid token account
sourcefn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey
fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey
Call after account length has already been verified to unpack the account owner
sourcefn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey
fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey
Call after account length has already been verified to unpack the account mint
sourcefn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey
fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey
Call after account length has already been verified to unpack a Pubkey at
the specified offset. Panics if account_data.len()
is less than PUBKEY_BYTES
Read more
sourcefn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey>
fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey>
Unpacks an account’s owner from opaque account data.
sourcefn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey>
fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey>
Unpacks an account’s mint from opaque account data.
sourceimpl IsInitialized for Account
impl IsInitialized for Account
sourcefn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Is initialized
sourceimpl Pack for Account
impl Pack for Account
sourcefn get_packed_len() -> usize
fn get_packed_len() -> usize
Get the packed length
sourcefn unpack(input: &[u8]) -> Result<Self, ProgramError> where
Self: IsInitialized,
fn unpack(input: &[u8]) -> Result<Self, ProgramError> where
Self: IsInitialized,
Unpack from slice and check if initialized
sourcefn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError>
fn unpack_unchecked(input: &[u8]) -> Result<Self, ProgramError>
Unpack from slice without checking if initialized
impl Copy for Account
impl Sealed for Account
impl StructuralPartialEq for Account
Auto Trait Implementations
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more