#[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§
Source§impl GenericTokenAccount for Account
impl GenericTokenAccount for Account
Source§fn 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
Source§fn 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
Source§fn 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
Source§fn 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
Source§impl IsInitialized for Account
impl IsInitialized for Account
Source§fn is_initialized(&self) -> bool
fn is_initialized(&self) -> bool
Is initialized
Source§impl Pack for Account
impl Pack for Account
Source§fn get_packed_len() -> usize
fn get_packed_len() -> usize
Get the packed length
Source§fn 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
Source§fn 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 Freeze for Account
impl RefUnwindSafe for Account
impl Send for Account
impl Sync for Account
impl Unpin for Account
impl UnwindSafe for Account
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)