light_token/compressed_token/v2/
token_metadata_ui.rs

1use borsh::{BorshDeserialize, BorshSerialize};
2use solana_pubkey::Pubkey;
3
4// TODO: add borsh compat test TokenMetadataUi TokenMetadata
5/// Ui Token metadata with Strings instead of bytes.
6#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
7pub struct TokenMetadataUi {
8    /// The authority that can sign to update the metadata
9    pub update_authority: Option<Pubkey>,
10    /// The associated mint, used to counter spoofing to be sure that metadata
11    /// belongs to a particular mint
12    pub mint: Pubkey,
13    pub metadata: MetadataUi,
14    /// Any additional metadata about the token as key-value pairs. The program
15    /// must avoid storing the same key twice.
16    pub additional_metadata: Vec<AdditionalMetadataUi>,
17    /// 0: Poseidon, 1: Sha256, 2: Keccak256, 3: Sha256Flat
18    pub version: u8,
19}
20
21#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
22pub struct MetadataUi {
23    /// The longer name of the token
24    pub name: String,
25    /// The shortened symbol for the token
26    pub symbol: String,
27    /// The URI pointing to richer metadata
28    pub uri: String,
29}
30
31#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize)]
32pub struct AdditionalMetadataUi {
33    /// The key of the metadata
34    pub key: String,
35    /// The value of the metadata
36    pub value: String,
37}