useAirdrop
Requests an airdrop of SOL to an address, as a reactive action.
Wraps client.airdrop with useAction: each dispatch(address, amount) runs the airdrop
with a fresh AbortSignal and tracks its lifecycle through React state. Calling dispatch again
while a previous airdrop is in flight aborts the first. This is a great fit for a devnet or
localnet "fund this account" button, where the isRunning / data / error tracking drives the
UI directly.
The airdrop capability is typically available on test networks (devnet, testnet) and local
validators. Some implementations (e.g. LiteSVM) update balances directly without sending a
transaction, in which case the resolved data is undefined rather than a Signature.
Parameters
| Parameter | Type | Description |
|---|---|---|
client | ClientWithAirdrop | A client with an airdrop plugin installed (ClientWithAirdrop). |
Returns
ActionResult<[Address, Lamports], Signature | undefined>
An ActionResult whose dispatch/dispatchAsync take the recipient address and
the amount of lamports, and resolve with the transaction Signature, or undefined
when the airdrop was performed without a transaction.