-
-
Notifications
You must be signed in to change notification settings - Fork 255
fix(assets): implement missing patch changes to nft and preferences controllers #4774
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
Conversation
tommasini
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
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.
| // 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; |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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)) |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Gudahtt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Explanation
This PR merges code that has been patched in the mobile client for over a year.
References
Changelog
@metamask/assets-controllersopenSeaEnabledtodisplayNftMediain NftControllersetApiKeyfunction from NftController since we do not use opensea anymore for NFT dataopenSeaApiKeyfrom NftController@metamask/preferences-controlleropenSeaEnabledtodisplayNftMediasetOpenSeaEnabledtosetDisplayNftMediaChecklist