Skip to content

internet-court/internet-court-skill / vendored/sendaifun/birdeye

birdeye

Verified

Complete Birdeye API integration for real-time DeFi data across Solana and 15 other chains. Use for token prices, OHLCV charts, market discovery, on-chain trader intelligence, holder analysis, wallet portfolio & P&L, and WebSocket streams for live prices and whale alerts.

examples/holder-data/holder-distribution.ts

View on GitHub
/**
 * Holder Distribution — Birdeye /holder/v1/distribution
 * Analyzes token holder concentration.
 *
 * IMPORTANT: param name is `token_address` (not `address`) — confirmed via live API.
 * Response: data.summary.wallet_count, data.holders[].wallet, data.holders[].percent_of_supply
 *
 * Run: BIRDEYE_API_KEY=xxx npx ts-node examples/holder-data/holder-distribution.ts
 */

import { BirdeyeClient } from '../../templates/birdeye-client';

async function run() {
    const apiKey = process.env.BIRDEYE_API_KEY;
    if (!apiKey) { console.error('Set BIRDEYE_API_KEY env var.'); process.exit(1); }

    const client = BirdeyeClient.createWithConfig({ apiKey, chain: 'solana' });
    const tokenAddress = process.env.TOKEN_ADDRESS || 'So11111111111111111111111111111111111111112';

    console.log(`Fetching holder distribution for ${tokenAddress}...`);

    try {
        const data = await client.holder.getDistribution(tokenAddress);

        const { summary, holders } = data;
        console.log('\n--- Holder Distribution ---');
        console.log(`Total Holders in Top Group: ${summary.wallet_count}`);
        console.log(`Total Holdings:             ${parseFloat(summary.total_holding).toLocaleString()}`);
        console.log(`% of Supply (top group):    ${summary.percent_of_supply?.toFixed(4)}%`);

        console.log('\nTop holders:');
        (holders || []).slice(0, 5).forEach((h: any, i: number) => {
            console.log(`  ${i + 1}. ${h.wallet} — ${h.percent_of_supply?.toFixed(4)}%`);
        });

        if (summary.percent_of_supply > 20) {
            console.warn('\n⚠️  HIGH CONCENTRATION: Top holders control >20% of supply.');
        } else {
            console.log('\n✅ Distribution looks healthy.');
        }
    } catch (e: any) {
        console.error('[Error]', e.message);
    }
}

run();
receiving-code-reviewobra/superpowersUse when receiving code review feedback, before implementing suggestions, especially if feedback seems unclear or technically questionable - requires technical rigor and verification, not performative agreement or blind implementationStars: 322kUpdated Claude CodeCodexVerifiedInstall
requesting-code-reviewobra/superpowersUse when completing tasks, implementing major features, or before merging to verify work meets requirementsStars: 322kUpdated Claude CodeCodexVerifiedInstall
using-git-worktreesobra/superpowersUse when starting feature work that needs isolation from current workspace or before executing implementation plans - ensures an isolated workspace exists via native tools or git worktree fallbackStars: 322kUpdated Claude CodeCodexVerifiedInstall
verification-before-completionobra/superpowersUse when about to claim work is complete, fixed, or passing, before committing or creating PRs - requires running verification commands and confirming output before making any success claims; evidence before assertions alwaysStars: 322kUpdated Claude CodeCodexVerifiedInstall