Fetch Airdrop

Fetch an airdrop's complete on-chain state including its configuration and current status. This is essential for monitoring distributions and building dashboards.

Basic Fetch Example

import { fetchAirdrop } from "@dropsy/airdrop";

async function getAirdrop(airdropPda: Address) {
  const airdrop = await fetchAirdrop(client.rpc, airdropPda);
  
  if (!airdrop.exists) {
    throw new Error("Airdrop not found");
  }

  console.log("Total supply:", airdrop.data.supply);
  console.log("Claim period:", airdrop.data.startsAt, "to", airdrop.data.endsAt);
  
  return airdrop;
}

Response Structure

{
  // Account metadata
  executable: false,       // Always false for PDAs
  lamports: 2032320n,     // Account balance (rent-exempt reserve)
  programAddress: 'Dropm...', // Program owning this account
  space: 164n,            // Bytes allocated
  address: '5y41...',     // Airdrop PDA address
  
  // Decoded airdrop data
  data: {
    authority: '5gB7...', // Creator's wallet
    mint: '7o7i...',      // Token mint being distributed
    controller: '2qJk...', // Managing controller
    supply: 500000n,      // Total tokens allocated
    merkleRoot: [ ... ],  // 32-byte Merkle root hash
    startsAt: 1750256471n, // Claim window start (UNIX timestamp)
    endsAt: 1750342871n,   // Claim window end
    bitmapCount: 1,        // Number of claim tracking pages
    version: 0,            // Airdrop version
    bump: 252              // PDA bump seed
  },
  
  exists: true             // Whether account exists
}
Account Metadata
  • lamports: SOL balance (rent-exempt minimum)
  • programAddress: Dropsy program ID
  • space: Bytes allocated (164 bytes)
  • exists: Account existence flag
Airdrop Configuration
  • authority: Creator wallet
  • mint: Token being distributed
  • supply: Total tokens allocated
  • merkleRoot: Eligibility proof root
  • startsAt/endsAt: Claim window
  • bitmapCount: Claim tracking pages
💡
Monitoring Tips
  • Check exists before interacting with airdrops
  • Use startsAt/endsAt to enforce claim periods