Skip to content

Instantly share code, notes, and snippets.

@SanariSan
Created February 12, 2025 18:15
Show Gist options
  • Save SanariSan/cf91fe5e10f91d0b9d9fafad94e054ff to your computer and use it in GitHub Desktop.
Save SanariSan/cf91fe5e10f91d0b9d9fafad94e054ff to your computer and use it in GitHub Desktop.
Is sol token freezable, chatgpt
const { Connection, PublicKey } = require('@solana/web3.js');
const { getMint } = require('@solana/spl-token');
async function checkTokenFreezable(tokenAddress) {
// Connect to Solana mainnet
const connection = new Connection('https://api.mainnet-beta.solana.com');
try {
// Create PublicKey from the token address
const mintPubkey = new PublicKey(tokenAddress);
// Get mint info
const mintInfo = await getMint(connection, mintPubkey);
// Check if the token is freezable
const freezeAuthority = mintInfo.freezeAuthorityOption
? 'Yes - Freeze Authority: ' + mintInfo.freezeAuthority.toBase58()
: 'No - Token cannot be frozen';
console.log(`Token: ${tokenAddress}`);
console.log(`Freezable: ${freezeAuthority}`);
// Additional mint information
console.log(`Supply: ${mintInfo.supply}`);
console.log(`Decimals: ${mintInfo.decimals}`);
console.log(`Mint Authority Present: ${mintInfo.mintAuthorityOption ? 'Yes' : 'No'}`);
} catch (error) {
console.error('Error checking token:', error);
}
}
// Check the specific token
checkTokenFreezable('FUAfBo2jgks6gB4Z4LfZkqSZgzNucisEHqnNebaRxM1P');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment