Skip to content

Conversation

@sahar-fehri
Copy link
Contributor

@sahar-fehri sahar-fehri commented Oct 9, 2024

Explanation

This PR merges code that has been patched in the mobile client for over a year.

References

Changelog

@metamask/assets-controllers

  • Rename openSeaEnabled to displayNftMedia in NftController
  • Remove setApiKey function from NftController since we do not use opensea anymore for NFT data
  • Remove openSeaApiKey from NftController

@metamask/preferences-controller

  • Rename openSeaEnabled to displayNftMedia
  • Rename setOpenSeaEnabled to setDisplayNftMedia

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 highlighted breaking changes using the "BREAKING" category above as appropriate
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

@sahar-fehri sahar-fehri marked this pull request as ready for review October 9, 2024 14:35
@sahar-fehri sahar-fehri requested a review from a team as a code owner October 9, 2024 14:35
@sahar-fehri sahar-fehri requested a review from a team October 9, 2024 14:35
tommasini
tommasini previously approved these changes Oct 9, 2024
Copy link
Contributor

@tommasini tommasini left a comment

Choose a reason for hiding this comment

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

LGTM

gambinish
gambinish previously approved these changes Jun 5, 2025
@amitabh94 amitabh94 changed the title fix: add missing settings from mobile patch fix(assets): align NFT media toggle, remove setApiKey, add safe chains validation Aug 13, 2025
@amitabh94 amitabh94 dismissed stale reviews from gambinish and tommasini via 59f2fcc August 13, 2025 23:51
@amitabh94 amitabh94 requested review from a team as code owners August 13, 2025 23:51
This commit cleans up the ESLint warning thresholds by removing the entries for `NftController.ts`, which are no longer necessary. This helps maintain a cleaner configuration and focuses on relevant files.
@amitabh94 amitabh94 changed the title fix(assets): align NFT media toggle, remove setApiKey, add safe chains validation fix(assets): implement missing patch changes to nft and preferences controllers Aug 13, 2025
// TODO: Mobile PreferencesController uses displayNftMedia, Extension PreferencesController uses openSeaEnabled
// TODO: Replace this type with PreferencesState once both clients use the same PreferencesController
displayNftMedia?: boolean;
openSeaEnabled?: boolean;
Copy link
Contributor

@bergarces bergarces Sep 24, 2025

Choose a reason for hiding this comment

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

This is the easiest way to ensure compatibility with both extension and mobile for the time being without major refactors in extension code for PreferencesController.

It will also ensure that when those changes are done and the same state is used for both clients, things will continue to work.

I have considered passing a function in the constructor that handles the mapping, but it seems overkill for two booleans and it would require additional changes for the clients.

### Changed

- **BREAKING:** Rename openSeaEnabled to displayNftMedia ([#4774](https://github.com/MetaMask/core/pull/4774))
- **BREAKING:** Rename setOpenSeaEnabled to setDisplayNftMedia ([#4774](https://github.com/MetaMask/core/pull/4774))
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though they are marked as BREAKING, these changes are already patch in the mobile client, so updating the controller and removing the changes from the mobile patch will not require any additional changes.


- **BREAKING:** Rename openSeaEnabled to displayNftMedia in NftController ([#4774](https://github.com/MetaMask/core/pull/4774))
- Ensure compatibility for extension preferences controller state
- **BREAKING:** Remove `setApiKey` function and `openSeaApiKey` from `NftController` since opensea is not used anymore for NFT data ([#4774](https://github.com/MetaMask/core/pull/4774))
Copy link
Contributor

Choose a reason for hiding this comment

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

Even though they are marked as BREAKING, these changes are already patch in the mobile client, so updating the controller and removing the changes from the mobile patch will only require removing the call to setApiKey.

For extension, it is already handling the possibility that the state sent from PreferencesController uses openSeaEnabled field, so no breaking changes either.

* @property isCurrentlyOwned - Boolean indicating whether the address/chainId combination where it's currently stored currently owns this NFT
* @property transactionId - Transaction Id associated with the NFT
*
* address - Hex address of a ERC721 contract
Copy link
Member

Choose a reason for hiding this comment

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

Nit: The proper way to document type properties would be alongside each property in the declaration, e.g. like here:

export const BridgeAssetSchema = type({

This will ensure the descriptions show up in IDEs, and get included in generated docs, and so on.

Copy link
Contributor

Choose a reason for hiding this comment

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

Good call.

I didn't realise when rebasing the PR. I have another PR in the oven for the remaining changes of PreferencesController, so I'll make sure that's fixed there.

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, some of the fields have slightly odd descriptions and some are missing. So I'll create a ticket to fix that.

Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

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

LGTM!

@bergarces bergarces merged commit 654158c into main Sep 24, 2025
239 checks passed
@bergarces bergarces deleted the fix/add-missing-settings-from-mobile-patch branch September 24, 2025 13:04
@Gudahtt Gudahtt mentioned this pull request Oct 3, 2025
4 tasks
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.

10 participants