Skip to content

fix(nft): fix internalNFTRevokeAll function #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 5.approval
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/nft-contract/approval.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,12 +166,12 @@ export function internalNftRevokeAll({
assert(predecessorAccountId == token.owner_id, "only token owner can revoke");

//only revoke if the approved account IDs for the token is not empty
if (token.approved_account_ids && Object.keys(token.approved_account_ids).length === 0 && Object.getPrototypeOf(token.approved_account_ids) === Object.prototype) {
if (token.approved_account_ids && Object.keys(token.approved_account_ids).length !== 0 && Object.getPrototypeOf(token.approved_account_ids) === Object.prototype) {
//refund the approved account IDs to the caller of the function
refundApprovedAccountIds(predecessorAccountId, token.approved_account_ids);
//clear the approved account IDs
token.approved_account_ids = {};
//insert the token back into the tokens_by_id collection with the approved account IDs cleared
contract.tokensById.set(tokenId, token);
}
}
}