Skip to content

fix: revert change on extension checking single NFT ownership#8435

Merged
juanmigdr merged 4 commits into
mainfrom
fix/regression-on-extension-check-ownership
Apr 13, 2026
Merged

fix: revert change on extension checking single NFT ownership#8435
juanmigdr merged 4 commits into
mainfrom
fix/regression-on-extension-check-ownership

Conversation

@juanmigdr

@juanmigdr juanmigdr commented Apr 13, 2026

Copy link
Copy Markdown
Member

Explanation

PR #8281 introduced a breaking change that removed checkAndUpdateSingleNftOwnershipStatus from NftController entirely, replacing it with a batch-only checkAndUpdateAllNftsOwnershipStatus flow. However, the MetaMask extension calls checkAndUpdateSingleNftOwnershipStatus directly after confirmed transactions to check ownership of a single NFT — making the removal a regression for extension consumers.

This PR restores checkAndUpdateSingleNftOwnershipStatus with an updated signature that aligns with the new architecture introduced in #8281: the batch boolean second argument is removed, the networkClientId is now the second argument (required), and the method always writes the updated NFT to state and returns it.

Additionally, a bug introduced in the restored implementation is fixed: the original draft called this.update() directly followed by this.#updateNestedNftState(), which also calls this.update() internally — causing two stateChanged events to fire for a single logical state change. The redundant this.update() call is removed so the method is consistent with every other NFT-mutating method in the controller.

References

Ticket: https://consensyssoftware.atlassian.net/browse/ASSETS-2959
Extension PR: MetaMask/metamask-extension#41689

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • I've communicated my changes to consumers by updating changelogs for packages I've changed
  • I've introduced breaking changes in this PR and have prepared draft pull requests for clients and consumer packages to resolve them

Note

Medium Risk
Reintroduces and changes the signature/behavior of checkAndUpdateSingleNftOwnershipStatus, which may break existing call sites and affects how NFT ownership state is mutated.

Overview
Restores NftController.checkAndUpdateSingleNftOwnershipStatus (removed in #8281) to fix consumers that perform per-NFT ownership checks, and implements it to call isNftOwner, update isCurrentlyOwned, persist the updated NFT back into allNfts, and return the updated object.

Updates documentation/tests: adds unit coverage for state updates and userAddress overrides, and updates the changelog to document the restored method plus the breaking signature change (removing the batch boolean argument).

Reviewed by Cursor Bugbot for commit 5593976. Bugbot is set up for automated code reviews on this repo. Configure here.

@juanmigdr juanmigdr requested review from a team as code owners April 13, 2026 09:26

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 82cff0e. Configure here.

Comment thread packages/assets-controllers/src/NftController.ts
@juanmigdr juanmigdr enabled auto-merge April 13, 2026 09:58
@juanmigdr juanmigdr added this pull request to the merge queue Apr 13, 2026
Merged via the queue into main with commit 53fc6c7 Apr 13, 2026
341 checks passed
@juanmigdr juanmigdr deleted the fix/regression-on-extension-check-ownership branch April 13, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants