pub trait GenericTokenAccount {
    fn valid_account_data(account_data: &[u8]) -> bool;

    fn unpack_account_owner_unchecked(account_data: &[u8]) -> &Pubkey { ... }
    fn unpack_account_mint_unchecked(account_data: &[u8]) -> &Pubkey { ... }
    fn unpack_pubkey_unchecked(account_data: &[u8], offset: usize) -> &Pubkey { ... }
    fn unpack_account_owner(account_data: &[u8]) -> Option<&Pubkey> { ... }
    fn unpack_account_mint(account_data: &[u8]) -> Option<&Pubkey> { ... }
}
Expand description

A trait for token Account structs to enable efficiently unpacking various fields without unpacking the complete state.

Required Methods

Check if the account data is a valid token account

Provided Methods

Call after account length has already been verified to unpack the account owner

Call after account length has already been verified to unpack the account mint

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

Unpacks an account’s owner from opaque account data.

Unpacks an account’s mint from opaque account data.

Implementors