Skip to content

Use new utility method from chain-agnostic-permission package: generateCaip25Caveat#31253

Closed
adonesky1 wants to merge 17 commits intodd/permission-connect-multichain-2from
ad/chain-agnostic-permission-flow-utilities
Closed

Use new utility method from chain-agnostic-permission package: generateCaip25Caveat#31253
adonesky1 wants to merge 17 commits intodd/permission-connect-multichain-2from
ad/chain-agnostic-permission-flow-utilities

Conversation

@adonesky1
Copy link
Copy Markdown
Contributor

@adonesky1 adonesky1 commented Mar 24, 2025

See this core PR where I've adapted some of the helpers to be more chain-agnostic: MetaMask/core#5536

Before:

Screen.Recording.2025-03-24.at.4.19.09.PM.mov

After:

Screen.Recording.2025-03-24.at.4.01.00.PM.mov

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@metamaskbot metamaskbot added the team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead label Mar 24, 2025
@socket-security
Copy link
Copy Markdown

socket-security bot commented Mar 24, 2025

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@metamask/chain-agnostic-permission@0.3.0 None 0 488 kB metamaskbot

View full report↗︎

@metamaskbot metamaskbot added the INVALID-PR-TEMPLATE PR's body doesn't match template label Mar 24, 2025
@metamaskbot
Copy link
Copy Markdown
Collaborator

❌ API Spec Test Failed. View the report here.

@metamaskbot
Copy link
Copy Markdown
Collaborator

❌ API Spec Test Failed. View the report here.

adonesky1 added a commit to MetaMask/core that referenced this pull request Mar 25, 2025
…aip25 permission (#5536)

## 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`,
`getPermittedEthChainIds` etc)

This PR adds some new helpers that are actually chain agnostic

## References

see @david0xd 's PR
[here](MetaMask/metamask-extension#31203)

and my extension PR ontop of it that uses these changes:
MetaMask/metamask-extension#31253

### `@metamask/chain-agnostic-permission`

- **CHANGED**: Renamed `caip-permission-adapter-eth-accounts.ts` to
`caip-permission-adapter-accounts.ts` to better reflect its more
generalized functionality.
- **ADDED**: New `setPermittedAccounts` function that allows setting
accounts for any CAIP namespace, not just EVM scopes.
- **ADDED**: New `addPermittedChainId` and `setPermittedChainIds`
functions for managing permitted chains across any CAIP namespace.
- **ADDED**: New `generateCaip25Caveat` function to simplify
modification of CAIP-25 permissions after UI confirmation.
- **ADDED**: New `isWalletScope` utility function to detect
wallet-related scopes.

## Checklist

- [ ] I've updated the test suite for new or updated code as appropriate
- [ ] I've updated documentation (JSDoc, Markdown, etc.) for new or
updated code as appropriate
- [ ] I've highlighted breaking changes using the "BREAKING" category
above as appropriate
- [ ] I've prepared draft pull requests for clients and consumer
packages to resolve any breaking changes
@adonesky1 adonesky1 force-pushed the dd/permission-connect-multichain-2 branch from d7a7d15 to 18cfedb Compare March 25, 2025 18:52
@adonesky1 adonesky1 force-pushed the ad/chain-agnostic-permission-flow-utilities branch from 6cd601b to 63409de Compare March 25, 2025 18:58
@metamaskbot
Copy link
Copy Markdown
Collaborator

❌ API Spec Test Failed. View the report here.

@adonesky1
Copy link
Copy Markdown
Contributor Author

Closed in favor of #31326

@adonesky1 adonesky1 closed this Mar 27, 2025
@github-actions github-actions bot locked and limited conversation to collaborators Mar 27, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

INVALID-PR-TEMPLATE PR's body doesn't match template team-wallet-api-platform-deprecated DEPRECATED: please use "team-wallet-integrations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants