#[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:

  1. [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:

  1. [writable] The SPL Token mint.
  2. [signer] Confidential transfer mint authority.
  3. [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
  1. [writeable] The SPL Token account.
  2. [] The corresponding SPL Token mint.
  3. [signer] The single source account owner.
  • Multisignature owner/delegate
  1. [writeable] The SPL Token account.
  2. [] The corresponding SPL Token mint.
  3. [] 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:

  1. [writable] The SPL Token account to approve.
  2. [] The SPL Token mint.
  3. [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
  1. [writable] The SPL Token account.
  2. [] Instructions sysvar.
  3. [signer] The single account owner.
  • Multisignature owner/delegate
  1. [writable] The SPL Token account.
  2. [] Instructions sysvar.
  3. [] 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
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account with confidential transfers configured.
  3. [] The token mint.
  4. [signer] The single source account owner or delegate.
  • Multisignature owner/delegate
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account with confidential transfers configured.
  3. [] The token mint.
  4. [] 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
  1. [writable] The source SPL Token account with confidential transfers configured.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [signer] The single source account owner.
  • Multisignature owner/delegate
  1. [writable] The source SPL Token account with confidential transfers configured.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [] 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
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [signer] The single source account owner.
  • Multisignature owner/delegate
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [] 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
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [signer] The single source account owner.
  • Multisignature owner/delegate
  1. [writable] The source SPL Token account.
  2. [writable] The destination SPL Token account.
  3. [] The token mint.
  4. [] Instructions sysvar.
  5. [] 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
  1. [writable] The SPL Token account.
  2. [signer] The single account owner.
  • Multisignature owner/delegate
  1. [writable] The SPL Token account.
  2. [] 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
  1. [writable] The SPL Token account.
  2. [signer] Single authority.
  • Multisignature owner/delegate
  1. [writable] The SPL Token account.
  2. [] 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
  1. [writable] The SPL Token account.
  2. [signer] The single account owner.
  • Multisignature owner/delegate
  1. [writable] The SPL Token account.
  2. [] 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
  1. [writable] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar.
  4. [signer] The mint’s withdraw_withheld_authority.
  • Multisignature owner/delegate
  1. [writable] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar.
  4. [] The mint’s multisig withdraw_withheld_authority.
  5. ..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
  1. [] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar.
  4. [signer] The mint’s withdraw_withheld_authority.
  5. ..3+N [writable] The source accounts to withdraw from.
  • Multisignature owner/delegate
  1. [] The token mint. Must include the TransferFeeConfig extension.
  2. [writable] The fee receiver account. Must include the TransferFeeAmount and ConfidentialTransferAccount extensions.
  3. [] Instructions sysvar.
  4. [] The mint’s multisig withdraw_withheld_authority.
  5. ..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:

  1. [writable] The mint.
  2. ..1+N [writable] The source accounts to harvest from.

Data expected by this instruction: None

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Converts to this type from the input type.

The type returned in the event of a conversion error.

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.