Skip to Content
DocumentationTokensCheck Token Account is Closed

Check Token Account is Closed

Checks if a token account is closed or doesn’t exist. Can be used with either a direct token account address or by specifying a wallet and mint.

Returns: Promise<boolean> - true if the account is closed or doesn’t exist, false if it exists and is open

const isClosed = await connection.checkTokenAccountIsClosed({ wallet: walletAddress, // Optional: Wallet address mint: mintAddress, // Optional: Mint address tokenAccount: tokenAccountAddress, // Optional: Direct token account address useTokenExtensions: false, // Optional: Use Token Extensions program instead of classic Token program });

Options

All options are optional, but you must provide either:

  • tokenAccount directly, OR

  • both wallet and mint to look up the associated token account

  • wallet: Address - The wallet address that owns the token account

  • mint: Address - The mint address of the token

  • tokenAccount: Address - The direct token account address to check

  • useTokenExtensions: boolean - Whether to use Token Extensions program (default: false)

Examples

Check if a specific token account is closed:

const isClosed = await connection.checkTokenAccountIsClosed({ tokenAccount: tokenAccountAddress, });

Check if a wallet’s token account for a specific mint is closed:

const isClosed = await connection.checkTokenAccountIsClosed({ wallet: walletAddress, mint: mintAddress, });

Check if a token account using Token Extensions is closed:

const isClosed = await connection.checkTokenAccountIsClosed({ tokenAccount: tokenAccountAddress, useTokenExtensions: true, });

See also: Get Token Account Balance

Last updated on