Airdrop a token
Last updated
Was this helpful?
Last updated
Was this helpful?
The TokenAirdropTransaction
allows users to transfer tokens to multiple accounts, handling both fungible tokens and NFTs. Unlike standard token transfers, if the receiver's account lacks available auto-association slots and is not already associated with the token, the transfer intent is captured as a pending transfer rather than failing. If the receiver has available auto-association slots, one is used, and the transaction payer covers the association fee and a fee for a full auto-renewal period. If resulting in a pending airdrop, the airdrop is stored in the network state until claimed by the intended receiver or canceled by the airdrop sender. It also differs from standard CryptoTransfer
transactions by not supporting HBAR transfers.
The sender account key.
The transaction fee payer account key if it differs from the sender.
Please see the transaction and query table for the base transaction fee.
Please use the to estimate the cost of your transaction fee.
addTokenTransfer(<tokenId>, <accountId>, <amount>)
TokenId, AccountId, int64
Add the from (sender) and to (receiver) account to transfer tokens. You will need to use this method twice. One will specify the the account sending the airdrop and the second will specify the account receiving the airdrop. The sending account must sign the transaction. The sender and recipient values must net zero.
addNftTransfer(<nftId>, <sender>, <receiver>)
NftId, AccountId, AccountId
Adds an NFT transfer to the transaction, specifying the NFT ID, the sender's account, and the receiver's account.
addTokenTransferWithDecimals(<tokenId>, <accountId>, <amount>, <decimals>)
TokenId, AccountId, int64, uint32
Adds a token transfer to the transaction with specified decimal precision, detailing the token ID, account, amount, and decimal places.
addApprovedTokenTransfer(<tokenId>, <accountId>, <amount>)
TokenId, AccountId, int64
The owner account ID and token the spender is authorized to transfer from. The debiting account is the owner account. Applicable to allowance transfers only.
addApprovedNftTransfer(<nftId>, <sender>, <receiver>)
NftId, AccountId, AccountId
The NFT ID the spender is authorized to transfer. The sender is the owner account and receiver is the receiving account. Applicable to allowance transfers only.
addApprovedTokenTransferWithDecimals(<tokenId>, <accountId>, <amount>, <decimals>)
TokenId, AccountId, int64, uint32
Adds an approved token transfer with decimal precision, specifying the owner account ID, token ID, and sender's account. Applicable to allowance transfers only.