Struct spl_token_metadata_interface::state::TokenMetadata
source · pub struct TokenMetadata {
pub update_authority: OptionalNonZeroPubkey,
pub mint: Pubkey,
pub name: String,
pub symbol: String,
pub uri: String,
pub additional_metadata: Vec<(String, String)>,
}
Expand description
Data struct for all token-metadata, stored in a TLV entry
The type and length parts must be handled by the TLV library, and not stored as part of this struct.
Fields§
The authority that can sign to update the metadata
mint: Pubkey
The associated mint, used to counter spoofing to be sure that metadata belongs to a particular mint
name: String
The longer name of the token
symbol: String
The shortened symbol for the token
uri: String
The URI pointing to richer metadata
additional_metadata: Vec<(String, String)>
Any additional metadata about the token as key-value pairs. The program must avoid storing the same key twice.
Implementations§
source§impl TokenMetadata
impl TokenMetadata
sourcepub fn tlv_size_of(&self) -> Result<usize, ProgramError>
pub fn tlv_size_of(&self) -> Result<usize, ProgramError>
Gives the total size of this struct as a TLV entry in an account
sourcepub fn set_key_value(&mut self, new_key: String, new_value: String)
pub fn set_key_value(&mut self, new_key: String, new_value: String)
Sets a key-value pair in the additional metadata
If the key is already present, overwrites the existing entry. Otherwise, adds it to the end.
sourcepub fn remove_key(&mut self, key: &str) -> bool
pub fn remove_key(&mut self, key: &str) -> bool
Removes the key-value pair given by the provided key. Returns true if the key was found.
Trait Implementations§
source§impl BorshDeserialize for TokenMetadatawhere
OptionalNonZeroPubkey: BorshDeserialize,
Pubkey: BorshDeserialize,
String: BorshDeserialize,
Vec<(String, String)>: BorshDeserialize,
impl BorshDeserialize for TokenMetadatawhere OptionalNonZeroPubkey: BorshDeserialize, Pubkey: BorshDeserialize, String: BorshDeserialize, Vec<(String, String)>: BorshDeserialize,
fn deserialize_reader<R: Read>(reader: &mut R) -> Result<Self, Error>
source§fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
fn deserialize(buf: &mut &[u8]) -> Result<Self, Error>
source§fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_slice(v: &[u8]) -> Result<Self, Error>
fn try_from_reader<R>(reader: &mut R) -> Result<Self, Error>where R: Read,
source§impl BorshSchema for TokenMetadatawhere
OptionalNonZeroPubkey: BorshSchema,
Pubkey: BorshSchema,
String: BorshSchema,
Vec<(String, String)>: BorshSchema,
impl BorshSchema for TokenMetadatawhere OptionalNonZeroPubkey: BorshSchema, Pubkey: BorshSchema, String: BorshSchema, Vec<(String, String)>: BorshSchema,
source§fn declaration() -> Declaration
fn declaration() -> Declaration
source§fn add_definitions_recursively(
definitions: &mut HashMap<Declaration, Definition>
)
fn add_definitions_recursively( definitions: &mut HashMap<Declaration, Definition> )
source§fn add_definition(
declaration: String,
definition: Definition,
definitions: &mut HashMap<String, Definition, RandomState>
)
fn add_definition( declaration: String, definition: Definition, definitions: &mut HashMap<String, Definition, RandomState> )
fn schema_container() -> BorshSchemaContainer
source§impl BorshSerialize for TokenMetadatawhere
OptionalNonZeroPubkey: BorshSerialize,
Pubkey: BorshSerialize,
String: BorshSerialize,
Vec<(String, String)>: BorshSerialize,
impl BorshSerialize for TokenMetadatawhere OptionalNonZeroPubkey: BorshSerialize, Pubkey: BorshSerialize, String: BorshSerialize, Vec<(String, String)>: BorshSerialize,
source§impl Clone for TokenMetadata
impl Clone for TokenMetadata
source§fn clone(&self) -> TokenMetadata
fn clone(&self) -> TokenMetadata
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TokenMetadata
impl Debug for TokenMetadata
source§impl Default for TokenMetadata
impl Default for TokenMetadata
source§fn default() -> TokenMetadata
fn default() -> TokenMetadata
source§impl PartialEq<TokenMetadata> for TokenMetadata
impl PartialEq<TokenMetadata> for TokenMetadata
source§fn eq(&self, other: &TokenMetadata) -> bool
fn eq(&self, other: &TokenMetadata) -> bool
self
and other
values to be equal, and is used
by ==
.source§impl SplDiscriminate for TokenMetadata
impl SplDiscriminate for TokenMetadata
source§const SPL_DISCRIMINATOR: ArrayDiscriminator = _
const SPL_DISCRIMINATOR: ArrayDiscriminator = _
Please use this discriminator in your program when matching
source§const SPL_DISCRIMINATOR_SLICE: &'static [u8] = Self::SPL_DISCRIMINATOR.as_slice()
const SPL_DISCRIMINATOR_SLICE: &'static [u8] = Self::SPL_DISCRIMINATOR.as_slice()
&[u8]
)