Enum spl_token_2022::extension::confidential_transfer::instruction::ConfidentialTransferInstruction
source · [−]#[repr(u8)]
pub enum ConfidentialTransferInstruction {
Show 14 variants
InitializeMint,
UpdateMint,
ConfigureAccount,
ApproveAccount,
EmptyAccount,
Deposit,
Withdraw,
Transfer,
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
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 FromPrimitive for ConfidentialTransferInstruction
impl FromPrimitive for ConfidentialTransferInstruction
sourcefn from_i64(n: i64) -> Option<Self>
fn from_i64(n: i64) -> Option<Self>
Converts an i64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u64(n: u64) -> Option<Self>
fn from_u64(n: u64) -> Option<Self>
Converts an u64
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_isize(n: isize) -> Option<Self>
fn from_isize(n: isize) -> Option<Self>
Converts an isize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i8(n: i8) -> Option<Self>
fn from_i8(n: i8) -> Option<Self>
Converts an i8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i16(n: i16) -> Option<Self>
fn from_i16(n: i16) -> Option<Self>
Converts an i16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i32(n: i32) -> Option<Self>
fn from_i32(n: i32) -> Option<Self>
Converts an i32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_i128(n: i128) -> Option<Self>
fn from_i128(n: i128) -> Option<Self>
Converts an i128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_usize(n: usize) -> Option<Self>
fn from_usize(n: usize) -> Option<Self>
Converts a usize
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u8(n: u8) -> Option<Self>
fn from_u8(n: u8) -> Option<Self>
Converts an u8
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u16(n: u16) -> Option<Self>
fn from_u16(n: u16) -> Option<Self>
Converts an u16
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u32(n: u32) -> Option<Self>
fn from_u32(n: u32) -> Option<Self>
Converts an u32
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourcefn from_u128(n: u128) -> Option<Self>
fn from_u128(n: u128) -> Option<Self>
Converts an u128
to return an optional value of this type. If the
value cannot be represented by this type, then None
is returned. Read more
sourceimpl ToPrimitive for ConfidentialTransferInstruction
impl ToPrimitive for ConfidentialTransferInstruction
sourcefn to_i64(&self) -> Option<i64>
fn to_i64(&self) -> Option<i64>
Converts the value of self
to an i64
. If the value cannot be
represented by an i64
, then None
is returned. Read more
sourcefn to_u64(&self) -> Option<u64>
fn to_u64(&self) -> Option<u64>
Converts the value of self
to a u64
. If the value cannot be
represented by a u64
, then None
is returned. Read more
sourcefn to_isize(&self) -> Option<isize>
fn to_isize(&self) -> Option<isize>
Converts the value of self
to an isize
. If the value cannot be
represented by an isize
, then None
is returned. Read more
sourcefn to_i8(&self) -> Option<i8>
fn to_i8(&self) -> Option<i8>
Converts the value of self
to an i8
. If the value cannot be
represented by an i8
, then None
is returned. Read more
sourcefn to_i16(&self) -> Option<i16>
fn to_i16(&self) -> Option<i16>
Converts the value of self
to an i16
. If the value cannot be
represented by an i16
, then None
is returned. Read more
sourcefn to_i32(&self) -> Option<i32>
fn to_i32(&self) -> Option<i32>
Converts the value of self
to an i32
. If the value cannot be
represented by an i32
, then None
is returned. Read more
sourcefn to_i128(&self) -> Option<i128>
fn to_i128(&self) -> Option<i128>
Converts the value of self
to an i128
. If the value cannot be
represented by an i128
(i64
under the default implementation), then
None
is returned. Read more
sourcefn to_usize(&self) -> Option<usize>
fn to_usize(&self) -> Option<usize>
Converts the value of self
to a usize
. If the value cannot be
represented by a usize
, then None
is returned. Read more
sourcefn to_u8(&self) -> Option<u8>
fn to_u8(&self) -> Option<u8>
Converts the value of self
to a u8
. If the value cannot be
represented by a u8
, then None
is returned. Read more
sourcefn to_u16(&self) -> Option<u16>
fn to_u16(&self) -> Option<u16>
Converts the value of self
to a u16
. If the value cannot be
represented by a u16
, then None
is returned. Read more
sourcefn to_u32(&self) -> Option<u32>
fn to_u32(&self) -> Option<u32>
Converts the value of self
to a u32
. If the value cannot be
represented by a u32
, then None
is returned. Read more
sourcefn to_u128(&self) -> Option<u128>
fn to_u128(&self) -> Option<u128>
Converts the value of self
to a u128
. If the value cannot be
represented by a u128
(u64
under the default implementation), then
None
is returned. Read more
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
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