Check every holding before a batched Hedera token dissociation
A wallet can request removal of several active token relationships at once. One nonzero balance can cause the requested cleanup to fail instead of removing only the empty relationships.
Read current holdings for each requested token
For ordinary active tokens, confirm the account is associated and its balance is zero. Include NFT serial ownership when checking a non-fungible token. In the example both relationships belong to the same wallet, whose authorization is required along with the transaction payer’s authorization.
const cleanup = new TokenDissociateTransaction()
.setAccountId(walletId)
.setTokenIds([tokenA, tokenB]);
Resolve the exact nonzero balance
If A holds zero and B holds one smallest unit, the combined operation can return TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES. Inspect the receipt before removing either relationship from local state. Rebuild the request for the intended eligible subset or wait until B is legitimately emptied. Check separate network rules for deleted token types instead of applying this active-token example unchanged.