Created
February 12, 2025 18:15
-
-
Save SanariSan/cf91fe5e10f91d0b9d9fafad94e054ff to your computer and use it in GitHub Desktop.
Is sol token freezable, chatgpt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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