Reject a token
Last updated
Was this helpful?
Last updated
Was this helpful?
The TokenRejectTransaction
allows users to reject and return unwanted airdrops to the treasury account without incurring custom fees. This transaction type supports rejecting the full balance of fungible tokens or individual NFT serial numbers with support for up to 10 token rejections in a single transaction. Rejection is not supported if the token has been frozen or paused. Note that the transaction does not dissociate the account from the token. To both reject and dissociate, use (see below).
Transaction Signing Requirements
The receiver/owner account key.
The transaction fee payer account key.
Transaction Fees
Please see the transaction and query table for the base transaction fee.
Please use the to estimate the cost of your transaction fee.
setOwnerId(accountId)
Sets the ID of the account holding/owning the tokens.
addTokenId(<tokenId>)
TokenId
Adds a token to be rejected.
setTokenIds(tokenIds)
List<TokenId>
Adds a list of one or more token IDs to be rejected.
addNftId(<nftId>)
TokenId
Adds a NFT ID to be rejected.
setNftIds(<nftIds>)
List<NftId>
Adds a list of one or more NFT IDs to be rejected.
The TokenRejectFlow
simplifies the process of rejecting unwanted tokens and dissociating from them in a single execute()
call. This flow combines both the TokenRejectTransaction
, which transfers the tokens back to the treasury, and the TokenDissociateTransaction
, which dissociates the account from the token. It streamlines the process by executing both actions in one single transaction.
Transaction Signing Requirements
The receiver/owner account key.
The transaction fee payer account key.
Transaction Fees
setOwnerId(accountId)
Sets the ID of the account holding/owning the tokens. This is the receiver account that will be rejecting the token.
addTokenId(<tokenId>)
TokenId
Adds a token ID to be rejected and dissociated.
setTokenIds(tokenIds)
List<TokenId>
Sets a list of one or more token IDs to be rejected and dissociated.
addNftId(<NftId>)
NftId
Adds a NFT ID to be rejected and dissociated.
setNftIds(<nftIds>)
List<NftId>
Sets a list of one or more NFT IDs to be rejected and dissociated.
Please see the transaction and query table for the base transaction fee.
Please use the to estimate the cost of your transaction fee.