-
-
Notifications
You must be signed in to change notification settings - Fork 200
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 caip25CaveatBuilder
to @metamask/multichain
#5064
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.
|
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!
listAccounts, | ||
}, | ||
}); | ||
const { validator } = caip25EndowmentBuilder.specificationBuilder({}); |
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: Strange that it lets you pass in an empty object here 🤔 It looks like it should take no parameters?
const { validator } = caip25EndowmentBuilder.specificationBuilder({}); | |
const { validator } = caip25EndowmentBuilder.specificationBuilder(); |
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.
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.
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!
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
…aveat' into jl/caip-25-move-validator-into-caveat
…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. [![Open in GitHub Codespaces](https://github.com/codespaces/badge.svg)](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.
Explanation
Moves the validator from the
caip25EndowmentBuilder
into a newcaip25CaveatBuilder
helper 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/multichain
caip25EndowmentBuilder
now only verifies that there is single CAIP-25 caveat and nothing else.caip25CaveatBuilder
helper that builds a specification for the CAIP-25 caveat that can be passed to the relevantPermissionController
constructor param.Checklist