Cancel a token

The TokenCancelAirdropTransaction allows a sender to cancel one or more pending airdrops they initiated. This transaction removes the specified pending airdrops from the network state, making them unavailable for future claims by the intended recipients. To execute this transaction, the sender must sign it, confirming their intent to cancel the pending transfers. All specified pending airdrops in the transaction must be successfully canceled for the transaction to complete. The cancellation does not provide a refund of any fees previously paid when creating the airdrop.

Transaction Signing Requirements

  • The sender account key.

  • The transaction fee payer account key if it differs from the sender.

Transaction Fees

  • Please see the transaction and query fees table for the base transaction fee.

  • Please use the Hedera fee estimator to estimate the cost of your transaction fee.

Method
Type
Description

addPendingAirdropId(<pendingAirdropId)

List<PendingAirdropId>

Adds the ID of a pending airdrop to the transaction, indicating which specific airdrop the sender wants to cancel. This method is used to reference and cancel one or more pending airdrops by their unique identifiers. The transaction can have up to 10 entries and must no have any duplicates.

// Create the token cancel airdrop transaction
TokenCancelAirdropTransaction transaction = new TokenCancelAirdropTransaction()
	.addPendingAirdropId(pendingAirdropId)
	.freezeWith(client);

// Sign with the sender account key and submit the transaction to a Hedera network
TransactionResponse txResponse = transaction.sign(accountKey).execute(client);

// Request the receipt of the transaction
TransactionReceipt receipt = txResponse.getReceipt(client);

// Get the transaction consensus status
Status transactionStatus = receipt.status;

System.out.println("The transaction consensus status: " + transactionStatus.toString());

// v2.51.0

Last updated

#2871: HIP-423 long term scheduled transactions

Change request updated