Uh oh!
There was an error while loading. Please reload this page.
chore: add more chain agnostic utility functions for interfacing w/ caip25 permission - #5536
Merged
adonesky1 merged 22 commits intoMar 25, 2025
Conversation
Loading
Uh oh!
There was an error while loading. Please reload this page.
Sign up for freeto 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
Currently the utility/helper functions we expose to interface with and help construct a valid caip25 permission caveat are very eth/evm centric (i.e.
setPermittedAccounts,addPermittedEthChainId,getPermittedEthChainIdsetc)This PR adds some new helpers that are actually chain agnostic
References
see @david0xd 's PR here
and my extension PR ontop of it that uses these changes:
MetaMask/metamask-extension#31253
@metamask/chain-agnostic-permissioncaip-permission-adapter-eth-accounts.tstocaip-permission-adapter-accounts.tsto better reflect its more generalized functionality.setPermittedAccountsfunction that allows setting accounts for any CAIP namespace, not just EVM scopes.addPermittedChainIdandsetPermittedChainIdsfunctions for managing permitted chains across any CAIP namespace.generateCaip25Caveatfunction to simplify modification of CAIP-25 permissions after UI confirmation.isWalletScopeutility function to detect wallet-related scopes.CHANGED : BREAKING Thecaip25:endowmentpermission caveat validator now throws an error when bothrequiredScopesandoptionalScopescontain no scopes.Moved to another PR: https://github.com/MetaMask/core/pull/5548.diff
Checklist