|
|
#!/bin/bash |
|
|
|
|
|
echo "🔥 Burning All Tokens in Wallet" |
|
|
echo "================================" |
|
|
echo "⚠️ This will permanently destroy ALL tokens in your wallet!" |
|
|
echo "📍 Cluster: devnet (safe for testing)" |
|
|
echo "" |
|
|
|
|
|
# Confirm before proceeding |
|
|
read -p "Are you sure you want to burn ALL tokens? (type 'yes' to confirm): " confirm |
|
|
if [ "$confirm" != "yes" ]; then |
|
|
echo "❌ Aborted - no tokens burned" |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
echo "🔥 Starting token burning process..." |
|
|
echo "" |
|
|
|
|
|
# List of token mints to burn (from spl-token accounts output) |
|
|
TOKENS=( |
|
|
"4auc435LJ9AfprLeMziHTJbP8wQmbSi7o4ZpeXdR66jQ" |
|
|
"5xEQF57sR2L3tJBfdiiqaVtepTMa7nQR9uMybMojEY8n" |
|
|
"8cJ8APx5TwwmpeRk4Zhz1Qbyi1T3HHdHUEw4GUJqxAGN" |
|
|
"AK9fXWyDNWurYjZSDhbqBo6fczqLmCLbCZ3vq9Vftsqb" |
|
|
) |
|
|
|
|
|
# Set to devnet |
|
|
solana config set --url devnet > /dev/null |
|
|
|
|
|
echo "💰 Current wallet: $(solana address)" |
|
|
echo "🌐 Cluster: devnet" |
|
|
echo "" |
|
|
|
|
|
# Function to burn tokens for a specific mint |
|
|
burn_token() { |
|
|
local mint=$1 |
|
|
echo "🔥 Processing mint: $mint" |
|
|
|
|
|
# Get the token account balance |
|
|
local balance=$(spl-token balance $mint --url devnet 2>/dev/null || echo "0") |
|
|
|
|
|
if [ "$balance" == "0" ] || [ -z "$balance" ]; then |
|
|
echo " ℹ️ No balance or account doesn't exist - skipping" |
|
|
return |
|
|
fi |
|
|
|
|
|
echo " 💰 Current balance: $balance" |
|
|
|
|
|
# Try to burn all tokens |
|
|
echo " 🔥 Burning $balance tokens..." |
|
|
local result=$(spl-token burn $mint $balance --url devnet 2>&1) |
|
|
|
|
|
if [ $? -eq 0 ]; then |
|
|
echo " ✅ Successfully burned $balance tokens" |
|
|
|
|
|
# Try to close the token account to reclaim SOL |
|
|
echo " 🗑️ Attempting to close token account..." |
|
|
spl-token close $mint --url devnet 2>/dev/null |
|
|
if [ $? -eq 0 ]; then |
|
|
echo " ✅ Token account closed and SOL reclaimed" |
|
|
else |
|
|
echo " ⚠️ Token account could not be closed (may still have remaining dust)" |
|
|
fi |
|
|
else |
|
|
echo " ❌ Failed to burn tokens: $result" |
|
|
fi |
|
|
|
|
|
echo "" |
|
|
} |
|
|
|
|
|
# Burn tokens for each mint |
|
|
for mint in "${TOKENS[@]}"; do |
|
|
burn_token $mint |
|
|
done |
|
|
|
|
|
echo "🎯 Token burning process complete!" |
|
|
echo "" |
|
|
echo "📊 Final token account status:" |
|
|
spl-token accounts --url devnet |
|
|
|
|
|
echo "" |
|
|
echo "💰 Final SOL balance:" |
|
|
solana balance --url devnet |
|
|
|
|
|
echo "" |
|
|
echo "✅ Ready for clean testing!" |
|
|
echo "🧪 You can now test the PoWH program from a clean state" |