Token-2022 IDL
TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEbSPL Token-2022 is the next-generation token program on Solana with rich extension support including transfer fees, confidential transfers, interest-bearing tokens, non-transferable tokens, and permanent delegates.
Instructions
Account Types
Integration Examples
Use the Token-2022 IDL in your application with these code examples for TypeScript, Rust, and Python.
import { Connection, PublicKey } from "@solana/web3.js";
import { Program, AnchorProvider, Idl } from "@coral-xyz/anchor";
// Load the Token-2022 IDL
import idl from "./token-2022.json";
const PROGRAM_ID = new PublicKey("TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb");
// Set up the provider and program
const connection = new Connection("https://api.mainnet-beta.solana.com");
const provider = new AnchorProvider(connection, wallet, {
commitment: "confirmed",
});
const program = new Program(idl as Idl, provider);
// Fetch and decode an account
const accountData = await program.account.token_2022
.fetch(accountPublicKey);
console.log("Account data:", accountData);
// Build and send an instruction
const tx = await program.methods
.initialize(/* ...args */)
.accounts({
/* ...required accounts */
})
.rpc();
console.log("Transaction signature:", tx);IDL JSON Preview
{
"version": "0.9.1",
"name": "spl_token_2022",
"instructions": [
{
"name": "initializeMint",
"accounts": [
{
"name": "mint",
"isMut": true,
"isSigner": false
},
{
"name": "rent",
"isMut": false,
"isSigner": false
}
],
"args": [
{
"name": "decimals",
"type": "u8"
},
{
"name": "mintAuthority",
"type": "publicKey"
},
{
"name": "freezeAuthority",
"type": {
...Frequently Asked Questions
What is the Token-2022 IDL?
The Token-2022 IDL (Interface Definition Language) is a JSON schema that defines the on-chain program interface for the Token-2022 smart contract on Solana. It describes all available instructions, account structures, events, and custom types that developers need to interact with the Token-2022 program. This IDL contains 43 instructions, 3 account types, 0 events, and 8 type definitions.
How do I use the Token-2022 IDL in my project?
Download the JSON file and import it in your project. With TypeScript, use the @coral-xyz/anchor package to create a Program instance. In Rust, use anchor-client. For Python, use anchorpy. See the integration examples above for complete code snippets in all three languages.
What is the Token-2022 program address on Solana?
The Token-2022 program is deployed at address TokenzQdBNbLqP5VEhdkAS6EPFLC1PHnBqCXEpPxuEb on Solana mainnet. You can verify this on any Solana block explorer.
What version of the Token-2022 IDL is this?
This is version 0.9.1 of the Token-2022 IDL. IDL versions correspond to specific program deployments and may be updated as the protocol evolves. Always verify compatibility with the on-chain program version before integrating.