TransferTransaction is required to set the spender account ID as the transaction fee payer. If the spender account ID is not set as the transaction fee payer, the system will error with SPENDER_DOES_NOT_HAVE_ALLOWANCE.
The maximum number of token approvals for the AccountAllowanceApproveTransaction cannot exceed 20. Note that each NFT serial number counts as a single approval. An AccountAllowanceApproveTransaction granting 20 NFT serial numbers to a spender will use all of the approvals permitted for the transaction.
A single NFT serial number can only be granted to one spender at a time. If an approval assigns a previously approved NFT serial number to a new user, the old user will have their approval removed.
Each owner account is limited to granting 100 allowances. This limit spans HBAR, fungible token allowances, and non-fungible token approved_for_all grants. No limit exists on the number of NFT serial number approvals an owner may grant.
The number of allowances set on an account will increase the auto-renewal fee for the account. Conversely, removing allowances will decrease the auto-renewal fee for the account.
To decrease the allowance for a given spender, you must set the amount to the value you would like to authorize the account for. If the spender account was authorized to spend 25 HBAR and the owner wants to modify their allowance to 5 HBAR, the owner would submit the AccountAllowanceApproveTransaction for 5 HBAR.
Only when a spender is set on an explicit NFT ID of a token, do we return the spender ID in TokenNftInfoQuery for the respective NFT. If approveTokenNftAllowanceAllSerials is used to approve all NFTs for a given token class, and no NFT ID is specified; we will not return a spender ID for all the serial numbers of that token.
Transaction Fees
- Please see the transaction and query fees table for the base transaction fee
- Please use the Hedera fee estimator to estimate your transaction fee cost
- Must be signed by the owner’s account
- Must be signed by the transaction fee payer if different then the owner account
- If the owner and transaction fee payer key are the same only one signature is required
Methods
| Type | Description | Method |
|---|---|---|
| AccountId, AccountId, Hbar | The owner account ID that is authorizing the allowance, the spender account ID to authorize, the amount of hbar the owner account is authorizing the spender account to use. | approveHbarAllowance(<ownerAccountId>,<spenderAccountId>, <amount>) |
AccountId, long | The token ID of the token being granted an allowance by the spender account, the account ID of the owner account, the account ID of the spender account. | approveTokenAllowance(<tokenId>,<ownerAccountId>,<spenderAccountId>, <amount>) |
| The NFT ID of the NFT being granted an allowance by the owner account, the account ID of the owner account, the account ID of the spender account. | approveTokenNftAllowance(<nftId>,<ownerAccountId>, <spenderAccountId>) | |
| Grant a spender account access to all NFTs in a given token class/collection. The token ID of the NFT collection, the account ID of the owner account, the account ID of the spender account. | approveTokenNftAllowanceAllSerials(<tokenId>,<ownerAccountId>, <spenderAccountId>) |