Skip to Content
AirdropairdropTokensBatch

airdropTokensBatch

This function performs large-scale airdrops using a batched approach.

Usage

page.tsx
import { useConnection, useWallet } from "@solana/wallet-adapter-react"; import { airdropTokensBatch } from "@okito/sdk"; const {connection} = useConnection(); const wallet = useWallet(); const mintAddress = ""; // mint address for the token const recipients = [ { address: "recipient1Address", amount: 100 }, { address: "recipient2Address", amount: 200 }, // ... thousands more recipients ]; const config = { batchSize: 15, batchDelayMs: 3000, progressCallback: (progress) => { console.log(`Progress: ${progress.completedBatches}/${progress.totalBatches} batches completed`); } }; const airdropResult = await airdropTokensBatch(connection, wallet, mintAddress, recipients, config);

Capabilities

  • Handles large recipient lists in batches
  • Optional progress callback for UI feedback
  • Per-batch retries with delays

Parameters

NameTypeDefault
connection
Connection
The connection object to the Solana blockchain.
wallet
SignerWallet
The wallet object of the sender.
mint
string
The mint address of the token being airdropped.
recipients
AirdropRecipient[]
Array of recipients (unlimited for large safe airdrop).
[]
config
AirdropInBatchesConfig
Configuration for the large-scale airdrop operation.
{}

AirdropInBatchesConfig

NameTypeDefault
batchSize
number
Number of recipients per batch (max 20).
15
batchDelayMs
number
Delay between batches in milliseconds (min 2000).
3000
maxBatchRetries
number
Maximum retry attempts per batch.
3
preflightValidation
boolean
Enable comprehensive preflight validation.
true
networkStabilityCheck
boolean
Check network stability before execution.
true
progressCallback
(progress: AirdropProgress) => void
Callback function for progress updates.
undefined
pauseOnError
boolean
Pause execution on repeated batch failures.
false
dryRun
boolean
Simulate the operation without sending transactions.
false
confirmationStrategy
'processed' | 'confirmed' | 'finalized'
Transaction confirmation level.
'finalized'
priorityFee
number
Priority fee in micro-lamports.
50000
createRecipientAccount
boolean
Automatically create recipient token accounts.
true

AirdropProgress

NameTypeDefault
totalBatches
number
Total number of batches to process.
completedBatches
number
Number of batches completed successfully.
failedBatches
number
Number of batches that failed.
totalRecipients
number
Total number of recipients.
processedRecipients
number
Number of recipients processed successfully.
failedRecipients
number
Number of recipients that failed.
currentBatch
number | undefined
Currently processing batch number.
estimatedTimeRemaining
number | undefined
Estimated time remaining in milliseconds.
lastTransactionId
string | undefined
Last successful transaction ID.

Response (Large Safe Airdrop)

NameTypeDefault
success
boolean
Whether the overall airdrop operation was successful.
transactionId
string | undefined
The first transaction ID (for compatibility).
transactionIds
string[] | undefined
Array of all transaction IDs from successful batches.
estimatedFee
number
Estimated total fee in lamports.
actualFee
number
Actual total fee paid in lamports.
confirmationTime
number
Total time taken for the operation in milliseconds.
recipientsProcessed
number
Number of recipients successfully processed.
recipientsFailed
number | undefined
Number of recipients that failed.
accountsCreated
number
Total number of token accounts created.
totalAmountSent
string
Total amount of tokens sent (in raw token units).
batchCount
number | undefined
Total number of batches processed.
successfulBatches
number | undefined
Number of batches completed successfully.
failedBatches
number | undefined
Number of batches that failed.
successRate
number | undefined
Success rate as a percentage (0-100).
error
string | undefined
Error message if the operation failed.
Last updated on