feat: Add caip25CaveatBuilder to @metamask/multichain - #5064
Merged
Conversation
Member
Author
|
@metamaskbot publish-preview |
Contributor
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
jiexi
marked this pull request as ready for review
December 12, 2024 21:26
Gudahtt
reviewed
Dec 13, 2024
| listAccounts, | ||
| }, | ||
| }); | ||
| const { validator } = caip25EndowmentBuilder.specificationBuilder({}); |
Member
There was a problem hiding this comment.
Nit: Strange that it lets you pass in an empty object here 🤔 It looks like it should take no parameters?
Suggested change
| const { validator } = caip25EndowmentBuilder.specificationBuilder({}); | |
| const { validator } = caip25EndowmentBuilder.specificationBuilder(); |
Member
There was a problem hiding this comment.
Ah, the type does require an options object, but we have it typed as Record<never, never>. Probably we should revert my suggestion here for now, but ultimately I think we should consider updating the specification builder type to let us exclude the options completely.
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
adonesky1
previously approved these changes
Dec 13, 2024
jiexi
enabled auto-merge (squash)
December 16, 2024 17:15
…aveat' into jl/caip-25-move-validator-into-caveat
adonesky1
approved these changes
Dec 16, 2024
jiexi
added a commit
to MetaMask/metamask-extension
that referenced
this pull request
Dec 16, 2024
…29166) <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Adopts `@metamask/mutlichain` changes that move validation logic out of the CAIP-25 permission and into the caveat itself. [](https://codespaces.new/MetaMask/metamask-extension/pull/29166?quickstart=1) ## **Related issues** Core: MetaMask/core#5064 ## **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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
Moves the validator from the
caip25EndowmentBuilderinto a newcaip25CaveatBuilderhelper to fix the incorrect full validation of the CAIP-25 caveat inside the CAIP-25 permission.References
See: MetaMask/metamask-extension#27847 (comment)
Extension: MetaMask/metamask-extension#29166
Changelog
@metamask/multichaincaip25EndowmentBuildernow only verifies that there is single CAIP-25 caveat and nothing else.caip25CaveatBuilderhelper that builds a specification for the CAIP-25 caveat that can be passed to the relevantPermissionControllerconstructor param.Checklist