light_sdk/
token.rs

1use light_compressed_account::compressed_account::CompressedAccountWithMerkleContext;
2
3use crate::{AnchorDeserialize, AnchorSerialize, Pubkey};
4
5#[derive(Clone, Copy, Debug, PartialEq, Eq, AnchorDeserialize, AnchorSerialize, Default)]
6#[repr(u8)]
7pub enum AccountState {
8    #[default]
9    Initialized,
10    Frozen,
11}
12// TODO: extract token data from program into into a separate crate, import it and remove this file.
13#[derive(Debug, PartialEq, Eq, AnchorDeserialize, AnchorSerialize, Clone, Default)]
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, PartialEq)]
31pub struct TokenDataWithMerkleContext {
32    pub token_data: TokenData,
33    pub compressed_account: CompressedAccountWithMerkleContext,
34}