Enum spl_token_2022::extension::confidential_transfer::instruction::ConfidentialTransferInstruction
source · #[repr(u8)]pub enum ConfidentialTransferInstruction {
Show 14 variants
InitializeMint = 0,
UpdateMint = 1,
ConfigureAccount = 2,
ApproveAccount = 3,
EmptyAccount = 4,
Deposit = 5,
Withdraw = 6,
Transfer = 7,
ApplyPendingBalance = 8,
EnableConfidentialCredits = 9,
DisableConfidentialCredits = 10,
EnableNonConfidentialCredits = 11,
DisableNonConfidentialCredits = 12,
TransferWithSplitProofs = 13,
}
Expand description
Confidential Transfer extension instructions
Variants§
InitializeMint = 0
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:
InitializeMintData
UpdateMint = 1
Updates the confidential transfer mint configuration for a mint.
Use TokenInstruction::SetAuthority
to update the confidential transfer
mint authority.
Accounts expected by this instruction:
[writable]
The SPL Token mint.[signer]
Confidential transfer mint authority.
Data expected by this instruction:
UpdateMintData
ConfigureAccount = 2
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 and non-confidential deposits and transfers
are enabled. Use the DisableConfidentialCredits
and
DisableNonConfidentialCredits
instructions to disable.
In order for this instruction to be successfully processed, it must be
accompanied by the VerifyPubkeyValidityProof
instruction of the
zk_token_proof
program in the same transaction or the address of a
context state account for the proof must be provided.
Accounts expected by this instruction:
- Single owner/delegate
[writeable]
The SPL Token account.[]
The corresponding SPL Token mint.[]
Instructions sysvar ifVerifyPubkeyValidityProof
is included in the same transaction or context state account ifVerifyPubkeyValidityProof
is pre-verified into a context state account.[signer]
The single source account owner.
- Multisignature owner/delegate
[writeable]
The SPL Token account.[]
The corresponding SPL Token mint.[]
Instructions sysvar ifVerifyPubkeyValidityProof
is included in the same transaction or context state account ifVerifyPubkeyValidityProof
is pre-verified into a context state account.[]
The multisig source account owner. 4..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
ConfigureAccountInstructionData
ApproveAccount = 3
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 mint authority.
Data expected by this instruction: None
EmptyAccount = 4
Empty the available balance in a confidential token account.
A token account that is extended for confidential transfers can only be
closed if the pending and available balance ciphertexts are emptied.
The pending balance can be emptied
via the ConfidentialTransferInstruction::ApplyPendingBalance
instruction. Use the ConfidentialTransferInstruction::EmptyAccount
instruction to empty the available balance ciphertext.
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.
In order for this instruction to be successfully processed, it must be
accompanied by the VerifyZeroBalanceProof
instruction of the
zk_token_proof
program in the same transaction or the address of a
context state account for the proof must be provided.
- Single owner/delegate
[writable]
The SPL Token account.[]
Instructions sysvar ifVerifyZeroBalanceProof
is included in the same transaction or context state account ifVerifyZeroBalanceProof
is pre-verified into a context state account.[signer]
The single account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
Instructions sysvar ifVerifyZeroBalanceProof
is included in the same transaction or context state account ifVerifyZeroBalanceProof
is pre-verified into a context state account.[]
The multisig account owner. 3..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
EmptyAccountInstructionData
Deposit = 5
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.
Fails if the associated mint is extended as NonTransferable
.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[]
The token mint.[signer]
The single account owner or delegate.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
The token mint.[]
The multisig account owner or delegate. 3..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
DepositInstructionData
Withdraw = 6
Withdraw SPL Tokens from the available balance of a confidential token account.
Fails if the source or destination accounts are frozen.
Fails if the associated mint is extended as NonTransferable
.
In order for this instruction to be successfully processed, it must be
accompanied by the VerifyWithdraw
instruction of the
zk_token_proof
program in the same transaction or the address of a
context state account for the proof must be provided.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[]
The token mint.[]
Instructions sysvar ifVerifyWithdraw
is included in the same transaction or context state account ifVerifyWithdraw
is pre-verified into a context state account.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
The token mint.[]
Instructions sysvar ifVerifyWithdraw
is included in the same transaction or context state account ifVerifyWithdraw
is pre-verified into a context state account.[]
The multisig source account owner. 4..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
WithdrawInstructionData
Transfer = 7
Transfer tokens confidentially.
In order for this instruction to be successfully processed, it must be
accompanied by either the VerifyTransfer
or
VerifyTransferWithFee
instruction of the zk_token_proof
program in the same transaction or the address of a context state
account for the proof must be provided.
Fails if the associated mint is extended as NonTransferable
.
- Single owner/delegate
[writable]
The source SPL Token account.[]
The token mint.[writable]
The destination SPL Token account.[]
Instructions sysvar ifVerifyTransfer
orVerifyTransferWithFee
is included in the same transaction or context state account if these proofs are pre-verified into a context state account.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The source SPL Token account.[]
The token mint.[writable]
The destination SPL Token account.[]
Instructions sysvar ifVerifyTransfer
orVerifyTransferWithFee
is included in the same transaction or context state account if these proofs are pre-verified into a context state account.[]
The multisig source account owner. 6..[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction:
TransferInstructionData
ApplyPendingBalance = 8
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
EnableConfidentialCredits = 9
Configure a confidential extension account to accept incoming confidential transfers.
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
DisableConfidentialCredits = 10
Configure a confidential extension account to reject any incoming confidential transfers.
If the allow_non_confidential_credits
field is true
, then the base
account can still receive non-confidential transfers.
This instruction can be used to disable confidential payments after a token account has already been extended for confidential transfers.
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
EnableNonConfidentialCredits = 11
Configure an account with the confidential extension to accept incoming non-confidential transfers.
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
DisableNonConfidentialCredits = 12
Configure an account with the confidential extension to reject any incoming non-confidential transfers.
This instruction can be used to configure a confidential extension account to exclusively receive confidential payments.
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
TransferWithSplitProofs = 13
Transfer tokens confidentially with zero-knowledge proofs that are split into smaller components.
In order for this instruction to be successfully processed, it must be accompanied by suitable zero-knowledge proof context accounts listed below.
The same restrictions for the Transfer
applies to
TransferWithSplitProofs
. Namely, the instruction fails if the
associated mint is extended as NonTransferable
.
- Transfer without fee
[writable]
The source SPL Token account.[]
The token mint.[writable]
The destination SPL Token account.[]
Context state account forVerifyCiphertextCommitmentEqualityProof
.[]
Context state account forVerifyBatchedGroupedCiphertext2HandlesValidityProof
.[]
Context state account forVerifyBatchedRangeProofU128
. Ifclose_split_context_state_on_execution
is set, all context state accounts must bewritable
and the following sequence of accounts that are marked with asterisk are needed: 7*.[]
The destination account for lamports from the context state accounts. 8*.[signer]
The context state account owner. 9*.[]
The zk token proof program.[signer]
The source account owner.
- Transfer with fee
[writable]
The source SPL Token account.[]
The token mint.[writable]
The destination SPL Token account.[]
Context state account forVerifyCiphertextCommitmentEqualityProof
.[]
Context state account forVerifyBatchedGroupedCiphertext2HandlesValidityProof
.[]
Context state account forVerifyFeeSigmaProof
.[]
Context state account forVerifyBatchedGroupedCiphertext2HandlesValidityProof
.[]
Context state account forVerifyBatchedRangeProofU256
. Ifclose_split_context_state_on_execution
is set, all context state accounts must bewritable
and the following sequence of accounts that are marked with asterisk are needed: 9*.[]
The destination account for lamports from the context state accounts. 10*.[signer]
The context state account owner. 11*.[]
The zk token proof program.[signer]
The source account owner.
Data expected by this instruction:
TransferWithSplitProofsInstructionData
Trait Implementations§
source§impl Clone for ConfidentialTransferInstruction
impl Clone for ConfidentialTransferInstruction
source§fn clone(&self) -> ConfidentialTransferInstruction
fn clone(&self) -> ConfidentialTransferInstruction
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl From<ConfidentialTransferInstruction> for u8
impl From<ConfidentialTransferInstruction> for u8
source§fn from(enum_value: ConfidentialTransferInstruction) -> Self
fn from(enum_value: ConfidentialTransferInstruction) -> Self
source§impl TryFrom<u8> for ConfidentialTransferInstruction
impl TryFrom<u8> for ConfidentialTransferInstruction
§type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
source§impl TryFromPrimitive for ConfidentialTransferInstruction
impl TryFromPrimitive for ConfidentialTransferInstruction
type Primitive = u8
type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
const NAME: &'static str = "ConfidentialTransferInstruction"
fn try_from_primitive( number: Self::Primitive, ) -> Result<Self, TryFromPrimitiveError<Self>>
impl Copy for ConfidentialTransferInstruction
Auto Trait Implementations§
impl Freeze for ConfidentialTransferInstruction
impl RefUnwindSafe for ConfidentialTransferInstruction
impl Send for ConfidentialTransferInstruction
impl Sync for ConfidentialTransferInstruction
impl Unpin for ConfidentialTransferInstruction
impl UnwindSafe for ConfidentialTransferInstruction
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
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