Integrate patch changes into core codebase #6307
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Explanation
The mobile codebase currently relies on a patch (
@metamask+assets-controllers+73.0.2.patch) to modify@metamask/assets-controllersand@metamask/preferences-controller. This patch introduces a new preference for displaying NFT media, removes OpenSea-specific API key handling, and adds a preference for safe chains list validation. The goal of this PR is to incorporate these changes directly into the core packages to eliminate the need for this mobile patch, simplifying maintenance and ensuring consistency across platforms.This PR implements the following changes:
openSeaEnabledtodisplayNftMedia: This change is applied acrossNftController(in@metamask/assets-controllers) andPreferencesController(in@metamask/preferences-controller), including state, methods, and tests. Backward compatibility foropenSeaEnabledis maintained during the transition to prevent immediate breaking changes for consumers.setApiKeymethod andopenSeaApiKeystate are removed fromNftController.useSafeChainsListValidation: A new state property and its corresponding setter are introduced inPreferencesController.The rename from
openSeaEnabledtodisplayNftMediais a semantic shift to broaden the scope beyond OpenSea and prepare for future NFT API integrations, decoupling the display logic from a specific provider. The removal of OpenSea API key functionality aligns with this broader strategy. Changes spanassets-controllersandpreferences-controllerbecauseNftControllerconsumes preferences managed byPreferencesController.References
@metamask+assets-controllers+73.0.2.patch@metamask+assets-controllers++multiformats+13.3.2.patchis a separate dependency/bundler issue that will be addressed by subsequent dependency bumps or removal in mobile after this PR is merged and published.Checklist