Skip to main content
Glama

scan_wallet

Scan a Solana wallet to identify empty token accounts with reclaimable SOL. Returns count of closeable accounts and estimated recoverable SOL without requiring private keys.

Instructions

Scan a Solana wallet for reclaimable SOL locked in empty token accounts. Returns count of closeable accounts and estimated SOL recoverable. Free, read-only — no private key needed.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
walletYesSolana wallet address (base58)

Implementation Reference

  • The 'scanWallet' function performs the actual backend API call to '/api/checkTokenAccounts' and processes the result to identify reclaimable SOL from token accounts.
    export async function scanWallet(walletAddress) {
        const data = await apiPost('/api/checkTokenAccounts', {
            walletAddresses: [walletAddress],
        });
        if (!data.success) {
            return {
                success: false,
                totalAccounts: 0,
                totalSolRecoverable: 0,
                tokenAccounts: [],
                burnAccounts: [],
                error: data.error || 'Scan failed',
            };
        }
        // API returns { wallets: [{ address, emptyAccounts, potentialReward, accounts: [...] }] }
        const wallets = data.wallets || [];
        const wallet = wallets[0] || {};
        const accounts = wallet.accounts || [];
        const tokenAccounts = accounts
            .filter(a => !a.hasBalance || Number(a.balance || 0) === 0)
            .map(a => ({
            pubkey: String(a.pubkey || a.address || ''),
            mint: String(a.mint || ''),
            amount: 0,
            rentLamports: 2039280,
        }));
        const burnAccounts = accounts
            .filter(a => a.hasBalance && Number(a.balance || 0) > 0)
            .map(a => ({
            pubkey: String(a.pubkey || a.address || ''),
            mint: String(a.mint || ''),
            amount: Number(a.balance || 0),
            rentLamports: 2039280,
        }));
        const totalAccounts = tokenAccounts.length + burnAccounts.length;
        const totalSolRecoverable = Number(wallet.potentialReward || 0) || totalAccounts * 0.00204;
        return {
            success: true,
            totalAccounts,
            totalSolRecoverable,
            tokenAccounts,
            burnAccounts,
        };
    }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/RefundYourSOL/refundyoursol-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server