Skip to Content

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, })
FieldDescription
paramsInstruction-specific values such as merkle roots, claim proofs, or timestamps
accountsThe accounts required by that instruction
payerThe public key that pays transaction fees
signersOptional 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.

MethodStep
createMerkleAirdropCreate the airdrop account
registerMerkleRootRegister one or more merkle roots
depositMerkleAirdropDeposit the allocation total
startMerkleAirdropActivate the airdrop
claimMerkleTokensClaim by submitting a leaf and proof
withdrawMerkleAirdropWithdraw remaining tokens after the airdrop end time
cancelMerkleAirdropCancel 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.

MethodStep
createOnchainAirdropCreate the airdrop account
appendOnchainRecipientsAppend batches of recipients
depositOnchainAirdropDeposit the allocation total
startOnchainAirdropActivate the airdrop
claimOnchainTokensClaim by recipient index
withdrawOnchainAirdropWithdraw remaining tokens after the airdrop end time
cancelOnchainAirdropCancel 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 merkle claim mode, continue to Merkle Tools for tree construction and proof derivation.
  • If you are using the onchain claim mode, skip ahead to On-chain List for recipient list helpers.
Last updated on