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
Last updated on