#[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
source§impl PartialEq for Account
impl PartialEq for Account
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: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
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
)source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more