Enum spl_token_2022::extension::confidential_transfer::instruction::ConfidentialTransferInstruction
source · [−]#[repr(u8)]
pub enum ConfidentialTransferInstruction {
Show 15 variants
InitializeMint,
UpdateMint,
ConfigureAccount,
ApproveAccount,
EmptyAccount,
Deposit,
Withdraw,
Transfer,
TransferWithFee,
ApplyPendingBalance,
EnableBalanceCredits,
DisableBalanceCredits,
WithdrawWithheldTokensFromMint,
WithdrawWithheldTokensFromAccounts,
HarvestWithheldTokensToMint,
}
Expand description
Confidential Transfer extension instructions
Variants
InitializeMint
Initializes confidential transfers for a mint.
The ConfidentialTransferInstruction::InitializeMint
instruction requires no signers
and MUST be included within the same Transaction as TokenInstruction::InitializeMint
.
Otherwise another party can initialize the configuration.
The instruction fails if the TokenInstruction::InitializeMint
instruction has already
executed for the mint.
Accounts expected by this instruction:
[writable]
The SPL Token mint.
Data expected by this instruction:
ConfidentialTransferMint
UpdateMint
Updates the confidential transfer mint configuration for a mint.
Accounts expected by this instruction:
[writable]
The SPL Token mint.[signer]
Confidential transfer mint authority.[signer]
New confidential transfer mint authority.
Data expected by this instruction:
ConfidentialTransferMint
ConfigureAccount
Configures confidential transfers for a token account.
The instruction fails if the confidential transfers are already configured, or if the mint was not initialized with confidential transfer support.
The instruction fails if the TokenInstruction::InitializeAccount
instruction has not yet
successfully executed for the token account.
Upon success confidential deposits and transfers are enabled, use the
DisableBalanceCredits
instruction to disable.
Accounts expected by this instruction:
- Single owner/delegate
[writeable]
The SPL Token account.[]
The corresponding SPL Token mint.[signer]
The single source account owner.
- Multisignature owner/delegate
[writeable]
The SPL Token account.[]
The corresponding SPL Token mint.[]
The multisig source account owner. 3..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
ConfigureAccountInstructionData
ApproveAccount
Approves a token account for confidential transfers.
Approval is only required when the ConfidentialTransferMint::approve_new_accounts
field is set in the SPL Token mint. This instruction must be executed after the account
owner configures their account for confidential transfers with
ConfidentialTransferInstruction::ConfigureAccount
.
Accounts expected by this instruction:
[writable]
The SPL Token account to approve.[]
The SPL Token mint.[signer]
Confidential transfer auditor authority.
Data expected by this instruction: None
EmptyAccount
Prepare a token account for closing. The account must not hold any confidential tokens in
its pending or available balances. Use
ConfidentialTransferInstruction::DisableBalanceCredits
to block balance credit changes
first if necessary.
Note that a newly configured account is always empty, so this instruction is not required
prior to account closing if no instructions beyond
ConfidentialTransferInstruction::ConfigureAccount
have affected the token account.
- Single owner/delegate
[writable]
The SPL Token account.[]
Instructions sysvar.[signer]
The single account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
Instructions sysvar.[]
The multisig account owner. 3..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
EmptyAccountInstructionData
Deposit
Deposit SPL Tokens into the pending balance of a confidential token account.
The account owner can then invoke the ApplyPendingBalance
instruction to roll the deposit
into their available balance at a time of their choosing.
Fails if the source or destination accounts are frozen.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account with confidential transfers configured.[]
The token mint.[signer]
The single source account owner or delegate.
- Multisignature owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account with confidential transfers configured.[]
The token mint.[]
The multisig source account owner or delegate. 4..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
DepositInstructionData
Withdraw
Withdraw SPL Tokens from the available balance of a confidential token account.
Fails if the source or destination accounts are frozen.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The source SPL Token account with confidential transfers configured.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The source SPL Token account with confidential transfers configured.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[]
The multisig source account owner. 5..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
WithdrawInstructionData
Transfer
Transfer tokens confidentially.
- Single owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[]
The multisig source account owner. 6..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
TransferInstructionData
TransferWithFee
Transfer tokens confidentially with fee.
- Single owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The source SPL Token account.[writable]
The destination SPL Token account.[]
The token mint.[]
Instructions sysvar.[]
The multisig source account owner. 6..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
TransferWithFeeInstructionData
ApplyPendingBalance
Applies the pending balance to the available balance, based on the history of Deposit
and/or Transfer
instructions.
After submitting ApplyPendingBalance
, the client should compare
ConfidentialTransferAccount::expected_pending_balance_credit_counter
with
ConfidentialTransferAccount::actual_applied_pending_balance_instructions
. If they are
equal then the ConfidentialTransferAccount::decryptable_available_balance
is consistent
with ConfidentialTransferAccount::available_balance
. If they differ then there is more
pending balance to be applied.
Account expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[signer]
The single account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
The multisig account owner. 2..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
ApplyPendingBalanceData
EnableBalanceCredits
Enable confidential transfer Deposit
and Transfer
instructions for a token account.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[signer]
Single authority.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
Multisig authority. 2..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction: None
DisableBalanceCredits
Disable confidential transfer Deposit
and Transfer
instructions for a token account.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[signer]
The single account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
The multisig account owner. 2..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction: None
WithdrawWithheldTokensFromMint
Transfer all withheld confidential tokens in the mint to an account. Signed by the mint’s withdraw withheld tokens authority.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar.[signer]
The mint’swithdraw_withheld_authority
.
- Multisignature owner/delegate
[writable]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar.[]
The mint’s multisigwithdraw_withheld_authority
.- ..3+M
[signer]
M signer accounts.
Data expected by this instruction: WithdrawWithheldTokensFromMintData
WithdrawWithheldTokensFromAccounts
Transfer all withheld tokens to an account. Signed by the mint’s withdraw withheld tokens
authority. This instruction is susceptible to front-running. Use
HarvestWithheldTokensToMint
and WithdrawWithheldTokensFromMint
as an alternative.
Note on front-running: This instruction requires a zero-knowledge proof verification
instruction that is checked with respect to the account state (the currently withheld
fees). Suppose that a withdraw withheld authority generates the
WithdrawWithheldTokensFromAccounts
instruction along with a corresponding zero-knowledge
proof for a specified set of accounts, and submits it on chain. If the withheld fees at any
of the specified accounts change before the WithdrawWithheldTokensFromAccounts
is
executed on chain, the zero-knowledge proof will not verify with respect to the new state,
forcing the transaction to fail.
If front-running occurs, then users can look up the updated states of the accounts,
generate a new zero-knowledge proof and try again. Alternatively, withdraw withheld
authority can first move the withheld amount to the mint using
HarvestWithheldTokensToMint
and then move the withheld fees from mint to a specified
destination account using WithdrawWithheldTokensFromMint
.
Accounts expected by this instruction:
- Single owner/delegate
[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar.[signer]
The mint’swithdraw_withheld_authority
.- ..3+N
[writable]
The source accounts to withdraw from.
- Multisignature owner/delegate
[]
The token mint. Must include theTransferFeeConfig
extension.[writable]
The fee receiver account. Must include theTransferFeeAmount
andConfidentialTransferAccount
extensions.[]
Instructions sysvar.[]
The mint’s multisigwithdraw_withheld_authority
.- ..4+M
[signer]
M signer accounts. 4+M+1. ..3+M+N[writable]
The source accounts to withdraw from.
Data expected by this instruction: WithdrawWithheldTokensFromAccountsData
HarvestWithheldTokensToMint
Permissionless instruction to transfer all withheld confidential tokens to the mint.
Succeeds for frozen accounts.
Accounts provided should include both the TransferFeeAmount
and
ConfidentialTransferAccount
extension. If not, the account is skipped.
Accounts expected by this instruction:
[writable]
The mint.- ..1+N
[writable]
The source accounts to harvest from.
Data expected by this instruction: None
Trait Implementations
sourceimpl Clone for ConfidentialTransferInstruction
impl Clone for ConfidentialTransferInstruction
sourcefn clone(&self) -> ConfidentialTransferInstruction
fn clone(&self) -> ConfidentialTransferInstruction
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl From<ConfidentialTransferInstruction> for u8
impl From<ConfidentialTransferInstruction> for u8
sourcefn from(enum_value: ConfidentialTransferInstruction) -> Self
fn from(enum_value: ConfidentialTransferInstruction) -> Self
Converts to this type from the input type.
sourceimpl TryFrom<u8> for ConfidentialTransferInstruction
impl TryFrom<u8> for ConfidentialTransferInstruction
type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
The type returned in the event of a conversion error.
sourcefn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>
fn try_from(number: u8) -> Result<Self, TryFromPrimitiveError<Self>>
Performs the conversion.
sourceimpl TryFromPrimitive for ConfidentialTransferInstruction
impl TryFromPrimitive for ConfidentialTransferInstruction
type Primitive = u8
const NAME: &'static str = "ConfidentialTransferInstruction"
fn try_from_primitive(
number: Self::Primitive
) -> Result<Self, TryFromPrimitiveError<Self>>
impl Copy for ConfidentialTransferInstruction
Auto Trait Implementations
impl RefUnwindSafe for ConfidentialTransferInstruction
impl Send for ConfidentialTransferInstruction
impl Sync for ConfidentialTransferInstruction
impl Unpin for ConfidentialTransferInstruction
impl UnwindSafe for ConfidentialTransferInstruction
Blanket Implementations
impl<T> AbiExample for T
impl<T> AbiExample for T
default fn example() -> T
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more