Skip to main content

Deploy & Test

This guide shows TypeScript usage examples for interacting with the Confidential SPL Token program using the Inco Solana SDK.

Setup


Getting Handles

There are two ways to get encrypted handles for decryption:

Option 1: From Transaction Logs

When your program emits handles in logs after an operation:

Option 2: From On-Chain Account

When the encrypted handle is stored in an account (like a token balance):

Handle Extraction Helper

Anchor returns BN (Big Number) objects for u128 encrypted handles. Use this helper to extract handles:

Decrypt Balance Helper

Combines handle extraction and decryption:

Mint Operations

initialize_mint

mint_to

mint_to_with_handle


Account Operations

initialize_account

close_account


Transfer Operations

transfer

transfer_with_handle

Transfer using an existing encrypted handle (e.g., transfer entire balance):

Delegation Operations

approve

revoke


Burn Operations

burn


Freeze/Thaw Operations

freeze_account

thaw_account


Authority Management

set_mint_authority

set_freeze_authority

set_account_owner

set_close_authority


Running Tests

Add await new Promise(resolve => setTimeout(resolve, 3000)) after operations that modify encrypted state to ensure handles are stored before decryption.