pub enum TokenMetadataInstruction {
Initialize(Initialize),
UpdateField(UpdateField),
RemoveKey(RemoveKey),
UpdateAuthority(UpdateAuthority),
Emit(Emit),
}
Expand description
All instructions that must be implemented in the token-metadata interface
Variants§
Initialize(Initialize)
Initializes a TLV entry with the basic token-metadata fields.
Assumes that the provided mint is an SPL token mint, that the metadata account is allocated and assigned to the program, and that the metadata account has enough lamports to cover the rent-exempt reserve.
Accounts expected by this instruction:
[w]
Metadata[]
Update authority[]
Mint[s]
Mint authority
Data: Initialize
data, name / symbol / uri strings
UpdateField(UpdateField)
Updates a field in a token-metadata account.
The field can be one of the required fields (name, symbol, URI), or a totally new field denoted by a “key” string.
By the end of the instruction, the metadata account must be properly resized based on the new size of the TLV entry.
- If the new size is larger, the program must first reallocate to avoid overwriting other TLV entries.
- If the new size is smaller, the program must reallocate at the end so that it’s possible to iterate over TLV entries
Accounts expected by this instruction:
[w]
Metadata account[s]
Update authority
Data: UpdateField
data, specifying the new field and value. If the
field does not exist on the account, it will be created. If the
field does exist, it will be overwritten.
RemoveKey(RemoveKey)
Removes a key-value pair in a token-metadata account.
This only applies to additional fields, and not the base name / symbol / URI fields.
By the end of the instruction, the metadata account must be properly resized at the end based on the new size of the TLV entry.
Accounts expected by this instruction:
[w]
Metadata account[s]
Update authority
Data: the string key to remove. If the idempotent flag is set to false, returns an error if the key is not present
UpdateAuthority(UpdateAuthority)
Updates the token-metadata authority
Accounts expected by this instruction:
[w]
Metadata account[s]
Current update authority
Data: the new authority. Can be unset using a None
value
Emit(Emit)
Emits the token-metadata as return data
The format of the data emitted follows exactly the TokenMetadata
struct, but it’s possible that the account data is stored in another
format by the program.
With this instruction, a program that implements the token-metadata
interface can return TokenMetadata
without adhering to the specific
byte layout of the TokenMetadata
struct in any accounts.
Accounts expected by this instruction:
[]
Metadata account
Implementations§
source§impl TokenMetadataInstruction
impl TokenMetadataInstruction
sourcepub fn unpack(input: &[u8]) -> Result<Self, ProgramError>
pub fn unpack(input: &[u8]) -> Result<Self, ProgramError>
Unpacks a byte buffer into a TokenMetadataInstruction.
Trait Implementations§
source§impl Clone for TokenMetadataInstruction
impl Clone for TokenMetadataInstruction
source§fn clone(&self) -> TokenMetadataInstruction
fn clone(&self) -> TokenMetadataInstruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for TokenMetadataInstruction
impl Debug for TokenMetadataInstruction
source§impl PartialEq for TokenMetadataInstruction
impl PartialEq for TokenMetadataInstruction
source§fn eq(&self, other: &TokenMetadataInstruction) -> bool
fn eq(&self, other: &TokenMetadataInstruction) -> bool
self
and other
values to be equal, and is used
by ==
.impl StructuralPartialEq for TokenMetadataInstruction
Auto Trait Implementations§
impl Freeze for TokenMetadataInstruction
impl RefUnwindSafe for TokenMetadataInstruction
impl Send for TokenMetadataInstruction
impl Sync for TokenMetadataInstruction
impl Unpin for TokenMetadataInstruction
impl UnwindSafe for TokenMetadataInstruction
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more