Airdrop if Required
Airdrops SOL to an address if its balance is below the specified threshold.
Returns: Promise<string | null> - Transaction signature if airdrop occurred, null if no airdrop was needed
const signature = await connection.airdropIfRequired(address, airdropAmount, minimumBalance);Options
address:Address- Address to check balance and potentially airdrop toairdropAmount:Lamports- Amount of lamports to airdrop if neededminimumBalance:Lamports- Minimum balance threshold that triggers airdropcommitment:Commitment(optional) - Desired commitment level . Can be"processed","confirmed", or"finalized"(default).
See also: Get Lamport Balance, Transfer Lamports
”You have requested too many airdrops for (some address)” error
Even though devnet and testnet SOL isn’t worth anything, people still try and abuse the Airdrop servers that provide devnet/testnet SOL. As a result, the amount of airdrops is limited. If you recieve an error stating “You have requested too many airdrops” visit the Solana Faucket , paste in the devnet/testnet address and retry.
Last updated on