-
-
Notifications
You must be signed in to change notification settings - Fork 215
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
feat: add multichain assets controller #5138
Conversation
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/utils.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
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.
Hello! I did a quick review of this controller and it looks pretty good, just had a few comments to align it with other controllers.
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/index.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/index.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Outdated
Show resolved
Hide resolved
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 from my side! I had another question, but it's non-blocking.
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.ts
Show resolved
Hide resolved
@metamaskbot publish-preview |
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions.
|
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
packages/assets-controllers/src/MultichainAssetsController/MultichainAssetsController.test.ts
Outdated
Show resolved
Hide resolved
* @param permission - The permission to get the `chainIds` caveat from. | ||
* @returns An array of `chainIds` that the snap supports. | ||
*/ | ||
// istanbul ignore next |
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.
For other reviews: Since this function comes from the snaps-*
packages, we decided to ignore the coverage for this one.
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.
We made it 🥳 Thanks a lot for addressing everything! 😄
Everything has now been addressed.
## **Description** PR to integrate the new MultichainAssetsController into metamask controller. [](https://codespaces.new/MetaMask/metamask-extension/pull/30059?quickstart=1) ## **Related issues** Fixes: Related: MetaMask/core#5138 ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **Pre-merge reviewer checklist** - [ ] I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed). - [ ] I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.
Explanation
This PR adds the new MultichainAssetsController. This controller manages non-evm tokens and metadata.
AccountsController:accountAdded
event and fetch assets for the account and update state accordinglyAccountsController:accountRemoved
event and remove assets from stateAccountsController:accountAssetListUpdated
and Update account assets with removed or added assets.References
Changelog
@metamask/assets-controllers
Checklist