light_sdk/
token.rs

1use anchor_lang::{AnchorDeserialize, AnchorSerialize};
2use solana_program::pubkey::Pubkey;
3
4use crate::compressed_account::CompressedAccountWithMerkleContext;
5
6#[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorDeserialize, AnchorSerialize)]
7#[repr(u8)]
8pub enum AccountState {
9    Initialized,
10    Frozen,
11}
12
13#[derive(Debug, PartialEq, Eq, AnchorDeserialize, AnchorSerialize, Clone)]
14pub struct TokenData {
15    /// The mint associated with this account
16    pub mint: Pubkey,
17    /// The owner of this account.
18    pub owner: Pubkey,
19    /// The amount of tokens this account holds.
20    pub amount: u64,
21    /// If `delegate` is `Some` then `delegated_amount` represents
22    /// the amount authorized by the delegate
23    pub delegate: Option<Pubkey>,
24    /// The account's state
25    pub state: AccountState,
26    /// Placeholder for TokenExtension tlv data (unimplemented)
27    pub tlv: Option<Vec<u8>>,
28}
29
30#[derive(Debug, Clone)]
31pub struct TokenDataWithMerkleContext {
32    pub token_data: TokenData,
33    pub compressed_account: CompressedAccountWithMerkleContext,
34}