AFAIK, as of today no wallets provide support to burn fungible tokens.
To burn spammy fungible tokens you can use spl-token command. spl-token command needs the wallet's private keys.
Run solana config get
to get your config details.
If Keypair path is set, it'll show up the path to the keypair.json, i,e /Users/userName/folder/keypair.json
Otherwise need to set the wallets private keypair by solana config set --keypair keypair_location
spl-token burn tokenAccountAddess 50
Other approach using NodeJS and @solana package
const {Connection, Keypair, PublicKey} = require('@solana/web3.js');
const { burn, getOrCreateAssociatedTokenAccount } = require('@solana/spl-token');
const fs = require('fs');
const RPC_URL = 'https://solana-api.projectserum.com';
const KEYPAIR_PATH = "/Users/pathtokeypair/keypair.json";
const secret = JSON.parse(fs.readFileSync(KEYPAIR_PATH));
const fromWallet = Keypair.fromSecretKey(Uint8Array.from(secret));
const payer = fromWallet;
const tokenMint = 'DfP3GKcq86B6VzGQrG3iupRWwqWcWnLndvFC2FTYKxiT'; // a spammy token
async function burn() {
const tokenMintPublicKey = new PublicKey(tokenMint);
const connection = new Connection(
RPC_URL,
{commitment:'confirmed', disableRetryOnRateLimit:false, confirmTransactionInitialTimeout:120000},
);
const tokenAccount = await getOrCreateAssociatedTokenAccount(
connection,
payer,
tokenMintPublicKey,
fromWallet.publicKey
);
const signature = await burn(
connection,
payer,
tokenAccount.address,
tokenMintPublicKey,
fromWallet.publicKey,
amountOfTokens * 9 // tokenDecimals of the tokenMint
[]
);
console.log('signature', signature);
return signature;
}
burn();
Note:- Take caution to not delete valid tokens.