ClientWithAirdrop

type ClientWithAirdrop = object;

Represents a client that can request airdrops of SOL to a specified address.

The airdrop capability is typically available on test networks (devnet, testnet) and local validators. It allows funding accounts with SOL for testing purposes.

Example

async function fundAccount(client: ClientWithAirdrop, address: Address) {
    const signature = await client.airdrop(address, lamports(1_000_000_000n));
    console.log(`Airdrop confirmed: ${signature ?? '[no signature]'}`);
}

Properties

airdrop()

airdrop: (address, amount, abortSignal?) => Promise<Signature | undefined>;

Requests an airdrop of SOL to the specified address.

The returned promise resolves when the airdrop succeeds and rejects on failure. Some implementations (e.g., LiteSVM) update account balances directly without sending a transaction, in which case no signature is returned.

Parameters

ParameterTypeDescription
addressAddressThe address to receive the airdrop.
amountLamportsThe amount of lamports to airdrop.
abortSignal?AbortSignalAn optional signal to abort the airdrop request.

Returns

Promise<Signature | undefined>

A promise resolving to the transaction signature if the airdrop was performed via a transaction, or undefined if no transaction was used.

On this page