Transactions
The SDK offers fourteen transaction builders — seven for each claim mode (merkle and onchain).
Call Shape
Every transaction method follows the same signature:
const tx = await client.someMethod({
params,
accounts,
payer,
signers,
})| Field | Description |
|---|---|
params | Instruction-specific values such as merkle roots, claim proofs, or timestamps |
accounts | The accounts required by that instruction |
payer | The public key that pays transaction fees |
signers | Optional Keypair array. When provided, the SDK signs the returned VersionedTransaction with these signers before handing it back. Omit signers if you are delegating signing to a wallet adapter |
The return value is always a VersionedTransaction.
Send the transaction with your own RPC layer (connection.sendTransaction) or a wallet adapter. The SDK never sends transactions itself.
Merkle Flow
Use the merkle flow when you have many recipients and want a compact on-chain footprint.
| Method | Step |
|---|---|
createMerkleAirdrop | Create the airdrop account |
registerMerkleRoot | Register one or more merkle roots |
depositMerkleAirdrop | Deposit the allocation total |
startMerkleAirdrop | Activate the airdrop |
claimMerkleTokens | Claim by submitting a leaf and proof |
withdrawMerkleAirdrop | Withdraw remaining tokens after the airdrop end time |
cancelMerkleAirdrop | Cancel before the airdrop is activated (startMerkleAirdrop) |
On-chain Flow
Use the on-chain flow when the recipient list is small enough to store directly on-chain.
| Method | Step |
|---|---|
createOnchainAirdrop | Create the airdrop account |
appendOnchainRecipients | Append batches of recipients |
depositOnchainAirdrop | Deposit the allocation total |
startOnchainAirdrop | Activate the airdrop |
claimOnchainTokens | Claim by recipient index |
withdrawOnchainAirdrop | Withdraw remaining tokens after the airdrop end time |
cancelOnchainAirdrop | Cancel before the airdrop is activated (startOnchainAirdrop) |
Signing and Sending
Once you have the VersionedTransaction:
import { Connection } from '@solana/web3.js'
const tx = await client.claimMerkleTokens({
params,
accounts,
payer: payer.publicKey,
signers: [payer, claimant],
})
const signature = await connection.sendTransaction(tx)
await connection.confirmTransaction(signature, 'confirmed')Because signers: [payer, claimant] was passed to the builder, the returned tx is already signed and ready for sendTransaction. If you are integrating with a browser wallet adapter instead, omit signers and pass the unsigned transaction to the wallet for signing.
Next Step
- If you are using the
merkleclaim mode, continue to Merkle Tools for tree construction and proof derivation. - If you are using the
onchainclaim mode, skip ahead to On-chain List for recipient list helpers.