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 | Connection The connection object to the Solana blockchain. |
|
wallet | SignerWallet The wallet object of the sender, conforming to the SignerWallet interface. |
|
mint | string The mint address of the token being airdropped. |
|
recipients | AirdropRecipient[] Array of recipients (max 30 for simple airdrop). |
|
config | AirdropConfig Optional configuration for the airdrop operation. |
|
AirdropConfig
Name | Type | Default |
---|---|---|
createRecipientAccount | boolean Automatically create the recipient's associated token account if it does not exist. |
|
Operation Config | OperationConfig Operation config for the airdrop operation. |
|
Response
Name | Type | Default |
---|---|---|
success | boolean Whether the airdrop operation was successful. |
|
transactionId | string | undefined The transaction ID of the successful airdrop. |
|
estimatedFee | number Estimated fee in lamports. |
|
actualFee | number Actual fee paid in lamports. |
|
confirmationTime | number Time taken for confirmation in milliseconds. |
|
recipientsProcessed | number The number of recipients successfully processed. |
|
accountsCreated | number The number of token accounts created. |
|
totalAmountSent | string The total amount of tokens sent (in raw token units). |
|
error | string | undefined Error message if the operation failed. |
|
Last updated on