Overview
Token-2022 is Solana’s next-generation token program. It supports extensions that add new behaviors to tokens - including a transfer fee extension that automatically deducts a percentage of each transfer. The Umbra SDK fully supports Token-2022 mints, including those with transfer fee extensions.Transfer Fees
When you deposit a Token-2022 token that has a transfer fee configured, the fee is deducted by the Token-2022 program before tokens reach the shielded pool. The SDK accounts for this by:- Fetching the mint account to detect the
TransferFeeConfigextension - Calling the epoch info provider to determine the current epoch
- Selecting the applicable fee schedule (Token-2022 supports epoch-based fee changes)
- Computing
actualReceived = amount - transferFee - Applying Umbra protocol fees on top of
actualReceived
actualReceived - protocolFees.
Epoch Info Provider
Transfer fee schedule selection requires knowing the current Solana epoch. This is whyepochInfoProvider is part of the IUmbraClient interface - it is fetched once per deposit operation for Token-2022 mints.
For standard SPL tokens (Token program), the epoch info provider is not called.
The provider defaults to an RPC-based implementation constructed from rpcUrl. You can override it if needed:
Fee Calculation
The SDK uses the same fee calculation as the Token-2022 program:feeBasisPoints and maximumFee are read from the epoch-appropriate fee schedule in the mint’s TransferFeeConfig extension.
No Special Configuration Required
You do not need to do anything special to use Token-2022 mints. Simply pass the Token-2022 mint address as you would any other mint:Affected Operations
Transfer fee handling applies to these operations:getDirectDepositIntoEncryptedBalanceFunction- fetches epoch info only when a Token-2022 transfer fee is detectedgetCreateSelfClaimableUtxoFromPublicBalanceFunction- samegetCreateReceiverClaimableUtxoFromPublicBalanceFunction- same