[−][src]Enum spl_token::instruction::TokenInstruction
Instructions supported by the token program.
Variants
Initializes a new mint and optionally deposits all the newly minted tokens in an account.
The InitializeMint
instruction requires no signers and MUST be included within
the same Transaction as the system program's CreateInstruction
that creates the account
being initialized. Otherwise another party can acquire ownership of the uninitialized account.
Accounts expected by this instruction:
[writable]
The mint to initialize.[]
Rent sysvar
Fields of InitializeMint
decimals: u8
Number of base 10 digits to the right of the decimal place.
The authority/multisignature to mint tokens.
The freeze authority/multisignature of the mint.
Initializes a new account to hold tokens. If this account is associated with the native mint then the token balance of the initialized account will be equal to the amount of SOL in the account. If this account is associated with another mint, that mint must be initialized before this command can succeed.
The InitializeAccount
instruction requires no signers and MUST be included within
the same Transaction as the system program's CreateInstruction
that creates the account
being initialized. Otherwise another party can acquire ownership of the uninitialized account.
Accounts expected by this instruction:
[writable]
The account to initialize.[]
The mint this account will be associated with.[]
The new account's owner/multisignature.[]
Rent sysvar
Initializes a multisignature account with N provided signers.
Warning, this instruction is compromised: https://github.com/solana-labs/solana-program-library/issues/477
Multisignature accounts can used in place of any single owner/delegate accounts in any token instruction that require an owner/delegate to be present. The variant field represents the number of signers (M) required to validate this multisignature account.
The DangerInitializeMultisig
instruction requires no signers and MUST be included within
the same Transaction as the system program's CreateInstruction
that creates the account
being initialized. Otherwise another party can acquire ownership of the uninitialized account.
Accounts expected by this instruction:
[writable]
The multisignature account to initialize.[]
Rent sysvar- ..2+N.
[]
The signer accounts, must equal to N where 1 <= N <= 11.
Fields of DangerInitializeMultisig
m: u8
The number of signers (M) required to validate this multisignature account.
Transfers tokens from one account to another either directly or via a delegate. If this account is associated with the native mint then equal amounts of SOL and Tokens will be transferred to the destination account.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The source account.[writable]
The destination account.[signer]
The source account's owner/delegate.
- Multisignature owner/delegate
[writable]
The source account.[writable]
The destination account.[]
The source account's multisignature owner/delegate.- ..3+M
[signer]
M signer accounts.
Fields of Transfer
amount: u64
The amount of tokens to transfer.
Approves a delegate. A delegate is given the authority over tokens on behalf of the source account's owner.
Accounts expected by this instruction:
- Single owner
[writable]
The source account.[]
The delegate.[signer]
The source account owner.
- Multisignature owner
[writable]
The source account.[]
The delegate.[]
The source account's multisignature owner.- ..3+M
[signer]
M signer accounts
Fields of Approve
amount: u64
The amount of tokens the delegate is approved for.
Revokes the delegate's authority.
Accounts expected by this instruction:
- Single owner
[writable]
The source account.[signer]
The source account owner.
- Multisignature owner
[writable]
The source account.[]
The source account's multisignature owner.- ..2+M
[signer]
M signer accounts
Sets a new authority of a mint or account.
Accounts expected by this instruction:
- Single authority
[writable]
The mint or account to change the authority of.[signer]
The current authority of the mint or account.
- Multisignature authority
[writable]
The mint or account to change the authority of.[]
The mint's or account's current multisignature authority.- ..2+M
[signer]
M signer accounts
Fields of SetAuthority
The type of authority to update.
The new authority
Mints new tokens to an account. The native mint does not support minting.
Accounts expected by this instruction:
- Single authority
[writable]
The mint.[writable]
The account to mint tokens to.[signer]
The mint's minting authority.
- Multisignature authority
[writable]
The mint.[writable]
The account to mint tokens to.[]
The mint's multisignature mint-tokens authority.- ..3+M
[signer]
M signer accounts.
Fields of MintTo
amount: u64
The amount of new tokens to mint.
Burns tokens by removing them from an account. Burn
does not support accounts
associated with the native mint, use CloseAccount
instead.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The account to burn from.[writable]
The token mint.[signer]
The account's owner/delegate.
- Multisignature owner/delegate
[writable]
The account to burn from.[writable]
The token mint.[]
The account's multisignature owner/delegate.- ..3+M
[signer]
M signer accounts.
Fields of Burn
amount: u64
The amount of tokens to burn.
Close an account by transferring all its SOL to the destination account. Non-native accounts may only be closed if its token amount is zero.
Accounts expected by this instruction:
- Single owner
[writable]
The account to close.[writable]
The destination account.[signer]
The account's owner.
- Multisignature owner
[writable]
The account to close.[writable]
The destination account.[]
The account's multisignature owner.- ..3+M
[signer]
M signer accounts.
Freeze an Initialized account using the Mint's freeze_authority (if set).
Accounts expected by this instruction:
- Single owner
[writable]
The account to freeze.[]
The token mint.[signer]
The mint freeze authority.
- Multisignature owner
[writable]
The account to freeze.[]
The token mint.[]
The mint's multisignature freeze authority.- ..3+M
[signer]
M signer accounts.
Thaw a Frozen account using the Mint's freeze_authority (if set).
Accounts expected by this instruction:
- Single owner
[writable]
The account to freeze.[]
The token mint.[signer]
The mint freeze authority.
- Multisignature owner
[writable]
The account to freeze.[]
The token mint.[]
The mint's multisignature freeze authority.- ..3+M
[signer]
M signer accounts.
Transfers tokens from one account to another either directly or via a delegate. If this account is associated with the native mint then equal amounts of SOL and Tokens will be transferred to the destination account.
This instruction differs from Transfer in that the token mint and decimals value is asserted by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The source account.[]
The token mint.[writable]
The destination account.[signer]
The source account's owner/delegate.
- Multisignature owner/delegate
[writable]
The source account.[]
The token mint.[writable]
The destination account.[]
The source account's multisignature owner/delegate.- ..4+M
[signer]
M signer accounts.
Fields of Transfer2
Approves a delegate. A delegate is given the authority over tokens on behalf of the source account's owner.
This instruction differs from Approve in that the token mint and decimals value is asserted by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Accounts expected by this instruction:
- Single owner
[writable]
The source account.[]
The token mint.[]
The delegate.[signer]
The source account owner.
- Multisignature owner
[writable]
The source account.[]
The token mint.[]
The delegate.[]
The source account's multisignature owner.- ..4+M
[signer]
M signer accounts
Fields of Approve2
Mints new tokens to an account. The native mint does not support minting.
This instruction differs from MintTo in that the decimals value is asserted by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Accounts expected by this instruction:
- Single authority
[writable]
The mint.[writable]
The account to mint tokens to.[signer]
The mint's minting authority.
- Multisignature authority
[writable]
The mint.[writable]
The account to mint tokens to.[]
The mint's multisignature mint-tokens authority.- ..3+M
[signer]
M signer accounts.
Fields of MintTo2
Burns tokens by removing them from an account. Burn2
does not support accounts
associated with the native mint, use CloseAccount
instead.
This instruction differs from Burn in that the decimals value is asserted by the caller. This may be useful when creating transactions offline or within a hardware wallet.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The account to burn from.[writable]
The token mint.[signer]
The account's owner/delegate.
- Multisignature owner/delegate
[writable]
The account to burn from.[writable]
The token mint.[]
The account's multisignature owner/delegate.- ..3+M
[signer]
M signer accounts.
Fields of Burn2
Implementations
impl TokenInstruction
[src]
pub fn unpack(input: &[u8]) -> Result<Self, ProgramError>
[src]
Unpacks a byte buffer into a TokenInstruction.
pub fn pack(&self) -> Vec<u8>
[src]
Packs a TokenInstruction into a byte buffer.
Trait Implementations
impl Clone for TokenInstruction
[src]
fn clone(&self) -> TokenInstruction
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for TokenInstruction
[src]
impl PartialEq<TokenInstruction> for TokenInstruction
[src]
fn eq(&self, other: &TokenInstruction) -> bool
[src]
fn ne(&self, other: &TokenInstruction) -> bool
[src]
impl StructuralPartialEq for TokenInstruction
[src]
Auto Trait Implementations
impl RefUnwindSafe for TokenInstruction
impl Send for TokenInstruction
impl Sync for TokenInstruction
impl Unpin for TokenInstruction
impl UnwindSafe for TokenInstruction
Blanket Implementations
impl<T> AbiExample for T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,