Skip to main content

Program Functions

This page documents all the on-chain functions available in the Confidential SPL Token program.

Mint Operations

initialize_mint

Creates a new confidential token mint.

mint_to

Mints confidential tokens to an account using encrypted ciphertext.
Pass remaining_accounts to automatically grant decryption access to the owner for the new balance handle. The allowance PDA must be derived from [new_handle.to_le_bytes(), owner_address]. See Access Control for the simulation pattern to get the handle before the transaction.

Account Operations

initialize_account

Creates a new confidential token account.

create

Creates an associated token account using PDA derivation.

create_idempotent

Creates an associated token account, succeeding silently if it already exists.
Use create_idempotent when you want to ensure the account exists without failing if it’s already created. This is useful for user-facing applications.

close_account

Closes a token account and reclaims the rent.
The account must have a zero balance to be closed. Balance verification should be done client-side before calling this function.

Transfer Operations

transfer

Transfers confidential tokens between accounts using encrypted ciphertext.
Pass remaining_accounts to grant decryption access to both source and destination owners for their new balance handles. Both source and destination get new handles after a transfer. See Access Control for the simulation pattern.

Delegation Operations

approve

Allows a delegate to spend tokens on behalf of the owner.
Pass remaining_accounts to grant decryption access to the delegate for the delegated amount handle.

revoke

Revokes delegate permissions.

Burn Operations

burn

Burns (destroys) tokens from an account.
Pass remaining_accounts to grant decryption access to the owner for their new balance handle after burning.

Freeze/Thaw Operations

freeze_account

Freezes a token account, preventing any transfers.

thaw_account

Unfreezes a previously frozen token account.
Only the freeze authority can freeze or thaw accounts. Frozen accounts cannot send or receive tokens until thawed.

Authority Management

set_mint_authority

Changes the mint authority.
Setting the mint authority to None permanently disables minting. This action cannot be undone.

set_freeze_authority

Changes the freeze authority.

set_account_owner

Changes account ownership.

set_close_authority

Changes the close authority for an account.

Account Structures

COption

A C-compatible option type used for optional fields:

AccountState

Token account states:

IncoMint

The mint account structure:

IncoAccount

The token account structure:

Instruction Account Contexts

InitializeMint

InitializeAccount

IncoMintTo

system_program is required when passing remaining_accounts for allowance operations, as the allowance PDA may need to be initialized.

IncoTransfer

IncoApprove

IncoRevoke

IncoBurn

FreezeAccount

ThawAccount

CloseAccount

SetMintAuthority

SetFreezeAuthority

SetAccountOwner

SetCloseAuthority


Error Codes


Next Steps

See Deploy & Test for TypeScript examples and test patterns using these functions.