Skip to Content
MiscairdropFees

estimateAirdropFees

Estimates total cost for an SPL token airdrop using local heuristics only. No transactions are sent and no RPC-dependent fee endpoints are called. The estimate includes:

  • rent for new recipient token accounts (fixed rent exemption for 165-byte ATA)
  • a local per-instruction fee model with a small buffer

For large recipient lists, actual airdrops are split across multiple transactions. The estimator uses a per-instruction heuristic per batch and sums across batches; values are conservative and may differ from on-chain execution.

Usage

page.tsx
import { useConnection } from "@solana/wallet-adapter-react"; import { estimateAirdropFee, type AirdropRecipient } from "@okito/sdk"; const recipients: AirdropRecipient[] = [ { address: "...", amount: 10n }, { address: "...", amount: 20n }, ]; const {connection} = useConnection(); const airdropFees = await estimateAirdropFee(connection, recipients, /* accountsToCreate */ 2);

Parameters

NameTypeDefault
connection
Connection
Solana connection instance.
recipients
AirdropRecipient[]
Recipient addresses and amounts (bigint recommended).
accountsToCreate
number
How many recipient ATAs are expected to be created.
priorityFee
number
Optional priority fee in micro‑lamports.

Response

NameTypeDefault
estimatedFee
number
Total estimated fee in lamports.
breakdown
{ transactionFees: number; accountCreations: number; priorityFees: number; }
Component costs.
Last updated on