Skip to content

​What Does Approving a Delegate Do?

Approving a delegate allows another address to transfer or burn a limited amount of tokens from a token account on behalf of the token account owner. A token account stores one current delegate and one delegated amount at a time. Approving a new delegate replaces the previous delegate and allowance on the account.

​How to Approve a Delegate

Approving a delegate uses the Token Program’s Approve or ApproveChecked instruction. The examples below use ApproveChecked, which requires the caller to provide the mint and decimals so the instruction can verify the expected mint and token precision before processing the approval. The token account owner signs the approval.

​Source Reference

ItemDescriptionToken ProgramToken Extension Program
AccountThe token account state stores the owner, delegate, and delegated amount.SourceSource
ApproveA delegate-approval instruction that records the delegate and allowance for a token account without requiring the caller to provide the mint or decimals.SourceSource
ApproveCheckedA delegate-approval instruction that requires the caller to provide the mint and decimals and checks those values before recording the delegate and allowance.SourceSource
process_approveShared processor logic for delegate approval.SourceSource

​Kit

These examples use @solana/kit.

​Web3.js v3

These examples use the class-based @solana/web3.js v3 API with @solana-program instruction builders.
Instructions

​Rust

Add these dependencies to Cargo.toml (tested with Rust 1.89 and 1.98):
Cargo.toml
Rust

​Python

This example uses solana (solana-py) 0.41 and solders:
Terminal
Python

​Web3.js (legacy)

These examples use legacy @solana/web3.js 1.x with @solana/spl-token.
@solana/web3.js 1.x is no longer actively maintainedIt receives critical fixes only. Use Kit for new code. To migrate existing code, follow the Kit upgrade guide, or the web3.js v3 migration guide to keep the class-based API.To run this code, install 1.x with npm install @solana/web3.js@1. A plain npm install @solana/web3.js installs v3, which this code doesn’t run on.