light_token_interface/state/extensions/
token_metadata.rs

1use light_compressed_account::Pubkey;
2use light_zero_copy::{ZeroCopy, ZeroCopyMut};
3
4use crate::{AnchorDeserialize, AnchorSerialize};
5
6/// Used for onchain serialization
7#[repr(C)]
8#[derive(
9    Debug, Clone, Hash, PartialEq, Eq, AnchorSerialize, AnchorDeserialize, ZeroCopy, ZeroCopyMut,
10)]
11pub struct TokenMetadata {
12    /// The authority that can sign to update the metadata
13    /// None if zero
14    pub update_authority: Pubkey,
15    /// The associated mint, used to counter spoofing to be sure that metadata
16    /// belongs to a particular mint
17    pub mint: Pubkey,
18    /// The longer name of the token
19    pub name: Vec<u8>,
20    /// The shortened symbol for the token
21    pub symbol: Vec<u8>,
22    /// The URI pointing to richer metadata
23    pub uri: Vec<u8>,
24    /// Any additional metadata about the token as key-value pairs. The program
25    /// must avoid storing the same key twice.
26    pub additional_metadata: Vec<AdditionalMetadata>,
27}
28
29#[repr(C)]
30#[derive(
31    Debug, Clone, Hash, PartialEq, Eq, AnchorSerialize, AnchorDeserialize, ZeroCopy, ZeroCopyMut,
32)]
33pub struct AdditionalMetadata {
34    /// The key of the metadata
35    pub key: Vec<u8>,
36    /// The value of the metadata
37    pub value: Vec<u8>,
38}