airdropTokens
Airdrops tokens to multiple recipients in a single operation (up to 30 recipients).
Usage
page.tsx
import { useConnection, useWallet } from "@solana/wallet-adapter-react";
import { airdropTokens } from "@okito/sdk";
const {connection} = useConnection();
const wallet = useWallet();
const mintAddress = ""; // mint address for the token
const recipients = [{
address: "", // the address to which the token is being airdropped
amount: 10.5 // the amount of the token to be airdropped
}];
const airdropResult = await airdropTokens(connection, wallet, mintAddress, recipients, config);Capabilities
- Single-transaction flow for small batches
- Auto-create recipient ATAs when enabled
- Clear per-recipient validation feedback
Limits
Up to 30 recipients per call. For larger distributions, use airdropTokensBatch.
Props
| Name | Type | Default |
|---|---|---|
connection | ConnectionThe connection object to the Solana blockchain. | |
wallet | SignerWalletThe wallet object of the sender, conforming to the SignerWallet interface. | |
mint | stringThe mint address of the token being airdropped. | |
recipients | AirdropRecipient[]Array of recipients (max 30 for simple airdrop). | |
config | AirdropConfigOptional configuration for the airdrop operation. | |
AirdropConfig
| Name | Type | Default |
|---|---|---|
createRecipientAccount | booleanAutomatically create the recipient's associated token account if it does not exist. | |
Operation Config | OperationConfigOperation config for the airdrop operation. | |
Response
| Name | Type | Default |
|---|---|---|
success | booleanWhether the airdrop operation was successful. | |
transactionId | string | undefinedThe transaction ID of the successful airdrop. | |
estimatedFee | numberEstimated fee in lamports. | |
actualFee | numberActual fee paid in lamports. | |
confirmationTime | numberTime taken for confirmation in milliseconds. | |
recipientsProcessed | numberThe number of recipients successfully processed. | |
accountsCreated | numberThe number of token accounts created. | |
totalAmountSent | stringThe total amount of tokens sent (in raw token units). | |
error | string | undefinedError message if the operation failed. | |
Last updated on