pub struct Token2022Account {
pub mint: Pubkey,
pub owner: Pubkey,
pub amount: u64,
pub delegate: Option<Pubkey>,
pub state: u8,
pub is_native: Option<u64>,
pub delegated_amount: u64,
pub close_authority: Option<Pubkey>,
pub extension_data: Vec<u8>,
}Expand description
To access extension data, use the has_extension and get_* methods provided by this struct. Supported extensions:
- TransferFee (fees applied on transfers)
- ConfidentialTransfer (private transfers)
- NonTransferable (tokens that cannot be transferred)
- InterestBearing (interest accruing tokens)
- CpiGuard (restrict cross-program invocations)
- MemoTransfer (require memo on transfers)
- DefaultAccountState (default frozen state)
- ImmutableOwner (cannot change account owner)
- PermanentDelegate (permanent authority)
- TokenMetadata (on-chain metadata)
- TransferHook (custom hooks on transfer)
- GroupPointer/GroupMemberPointer (token grouping)
- ConfidentialTransferFee (private transfers with fees)
- MetadataPointer (pointer to off-chain metadata)
- MintCloseAuthority (authority to close mint)
- Pausable (ability to pause transfers)
- ScaledUiAmount (custom UI amount scaling)
Fields§
§mint: Pubkey§owner: Pubkey§amount: u64§delegate: Option<Pubkey>§state: u8§is_native: Option<u64>§delegated_amount: u64§extension_data: Vec<u8>Raw extension data for accessing all Token-2022 extensions
Implementations§
Source§impl Token2022Account
impl Token2022Account
Sourcepub fn has_extension(&self, extension_type: ExtensionType) -> bool
pub fn has_extension(&self, extension_type: ExtensionType) -> bool
Check if account has a specific extension type
Sourcepub fn get_transfer_fee(&self) -> Option<TransferFeeConfig>
pub fn get_transfer_fee(&self) -> Option<TransferFeeConfig>
Get transfer fee configuration if present
Sourcepub fn is_non_transferable(&self) -> bool
pub fn is_non_transferable(&self) -> bool
Check if token is non-transferable
Sourcepub fn get_interest_config(&self) -> Option<InterestBearingConfig>
pub fn get_interest_config(&self) -> Option<InterestBearingConfig>
Get interest bearing configuration if present
Sourcepub fn is_cpi_guarded(&self) -> bool
pub fn is_cpi_guarded(&self) -> bool
Check if CPI guard is enabled
Sourcepub fn has_confidential_transfers(&self) -> bool
pub fn has_confidential_transfers(&self) -> bool
Check if confidential transfers are enabled
Trait Implementations§
Source§impl Debug for Token2022Account
impl Debug for Token2022Account
Auto Trait Implementations§
impl Freeze for Token2022Account
impl RefUnwindSafe for Token2022Account
impl Send for Token2022Account
impl Sync for Token2022Account
impl Unpin for Token2022Account
impl UnwindSafe for Token2022Account
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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