#[repr(u8)]pub enum ConfidentialTransferInstruction {
Show 15 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,
TransferWithFee = 13,
ConfigureAccountWithRegistry = 14,
}
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 VerifyPubkeyValidity
instruction of the
zk_elgamal_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 ifVerifyPubkeyValidity
is included in the same transaction or context state account ifVerifyPubkeyValidity
is pre-verified into a context state account.[]
(Optional) Record account if the accompanying proof is to be read from a record account.[signer]
The single source account owner.
- Multisignature owner/delegate
[writeable]
The SPL Token account.[]
The corresponding SPL Token mint.[]
Instructions sysvar ifVerifyPubkeyValidity
is included in the same transaction or context state account ifVerifyPubkeyValidity
is pre-verified into a context state account.[]
(Optional) Record account if the accompanying proof is to be read from a record account.[]
The multisig source account owner.- ..
[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 VerifyZeroCiphertext
instruction of the
zk_elgamal_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 ifVerifyZeroCiphertext
is included in the same transaction or context state account ifVerifyZeroCiphertext
is pre-verified into a context state account.[]
(Optional) Record account if the accompanying proof is to be read from a record account.[signer]
The single account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
Instructions sysvar ifVerifyZeroCiphertext
is included in the same transaction or context state account ifVerifyZeroCiphertext
is pre-verified into a context state account.[]
(Optional) Record account if the accompanying proof is to be read from a record account.[]
The multisig account owner.- ..
[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
.
Fails if the associated mint is extended as ConfidentialMintBurn
.
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.- ..
[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.
In order for this instruction to be successfully processed, it must be
accompanied by the following list of zk_elgamal_proof
program
instructions:
VerifyCiphertextCommitmentEquality
VerifyBatchedRangeProofU64
These instructions can be accompanied in the same transaction or can be pre-verified into a context state account, in which case, only their context state account address need to be provided.
Fails if the source or destination accounts are frozen.
Fails if the associated mint is extended as NonTransferable
.
Fails if the associated mint is extended as ConfidentialMintBurn
.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[]
The token mint.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Range proof record account or context state account.[signer]
The single source account owner.
- Multisignature owner/delegate
[writable]
The SPL Token account.[]
The token mint.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Range proof record account or context state account.[]
The multisig source account owner.- ..
[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 the following list of zk_elgamal_proof
program
instructions:
VerifyCiphertextCommitmentEquality
VerifyBatchedGroupedCiphertext3HandlesValidity
VerifyBatchedRangeProofU128
These instructions can be accompanied in the same transaction or can be pre-verified into a context state account, in which case, only their context state account addresses need to 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.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Ciphertext validity proof record account or context state account.[]
(Optional) Range proof record account or 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.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Ciphertext validity proof record account or context state account.[]
(Optional) Range proof record account or context state account.[]
The multisig source account owner.- ..
[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.- ..
[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.- ..
[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.- ..
[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.- ..
[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.- ..
[signer]
Required M signer accounts for the SPL Token Multisig account.
Data expected by this instruction: None
TransferWithFee = 13
Transfer tokens confidentially with fee.
In order for this instruction to be successfully processed, it must be
accompanied by the following list of zk_elgamal_proof
program
instructions:
VerifyCiphertextCommitmentEquality
VerifyBatchedGroupedCiphertext3HandlesValidity
(transfer amount ciphertext)VerifyPercentageWithFee
VerifyBatchedGroupedCiphertext2HandlesValidity
(fee ciphertext)VerifyBatchedRangeProofU256
These instructions can be accompanied in the same transaction or can be pre-verified into a context state account, in which case, only their context state account addresses need to be provided.
The same restrictions for the Transfer
applies to
TransferWithFee
. 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.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Transfer amount ciphertext validity proof record account or context state account.[]
(Optional) Fee sigma proof record account or context state account.[]
(Optional) Fee ciphertext validity proof record account or context state account.[]
(Optional) Range proof record account or context state account.[signer]
The source account owner.
- Transfer with fee
[writable]
The source SPL Token account.[]
The token mint.[writable]
The destination SPL Token account.[]
(Optional) Instructions sysvar if at least one of thezk_elgamal_proof
instructions are included in the same transaction.[]
(Optional) Equality proof record account or context state account.[]
(Optional) Transfer amount ciphertext validity proof record account or context state account.[]
(Optional) Fee sigma proof record account or context state account.[]
(Optional) Fee ciphertext validity proof record account or context state account.[]
(Optional) Range proof record account or context state account.[]
The multisig source account owner.- ..
[signer]
Required M signer accounts for the SPL Token Multisig
Data expected by this instruction:
TransferWithFeeInstructionData
ConfigureAccountWithRegistry = 14
Configures confidential transfers for a token account.
This instruction is identical to the ConfigureAccount
account except
that a valid ElGamalRegistry
account is expected in place of the
VerifyPubkeyValidity
proof.
An ElGamalRegistry
account is valid if it shares the same owner with
the token account. If a valid ElGamalRegistry
account is provided,
then the program skips the verification of the ElGamal pubkey
validity proof as well as the token owner signature.
If the token account is not large enough to include the new cconfidential transfer extension, then optionally reallocate the account to increase the data size. To reallocate, a payer account to fund the reallocation and the system account should be included in the instruction.
Accounts expected by this instruction:
- Single owner/delegate
[writable]
The SPL Token account.[]
The corresponding SPL Token mint.[]
The ElGamal registry account.[signer, writable]
(Optional) The payer account to fund reallocation[]
(Optional) System program for reallocation funding
Data expected by this instruction: None
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
Source§type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
type Error = TryFromPrimitiveError<ConfidentialTransferInstruction>
Source§impl TryFromPrimitive for ConfidentialTransferInstruction
impl TryFromPrimitive for ConfidentialTransferInstruction
const NAME: &'static str = "ConfidentialTransferInstruction"
type Primitive = u8
type Error = TryFromPrimitiveError<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§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