Skip to content

feat: Add multichain connection capabilities#31203

Closed
david0xd wants to merge 4 commits intosip-26from
dd/permission-connect-multichain-2
Closed

feat: Add multichain connection capabilities#31203
david0xd wants to merge 4 commits intosip-26from
dd/permission-connect-multichain-2

Conversation

@david0xd
Copy link
Copy Markdown
Contributor

@david0xd david0xd commented Mar 21, 2025

Description

This PR adds support for multichain dapp connections.

Open in GitHub Codespaces

Related issues

Fixes: https://github.com/MetaMask/MetaMask-planning/issues/3660

Manual testing steps

  1. Create your own CAIP requests and request specific multichain permissions from wallet.
  2. Or, use test dapp, multichain test dapp, or similar if available.
  3. Make these requests and check UX/UI around accounts, network and connectivity.
  4. It should support new things like Solana connections, but it should also be backwards compatible with everything else related to the EVM.

Screenshots/Recordings

Before

For previous version look at description of this PR: #30164

After

Connecting to Solana (CAIP)

Screen.Recording.2025-03-21.at.17.46.30.mov

Connecting to Solana and EVM (CAIP)

Screen.Recording.2025-03-21.at.18.43.28.mov

Connecting to EVM (CAIP)

Screen.Recording.2025-03-21.at.17.51.50.mov

Old (legacy) connection flow

Screen.Recording.2025-03-21.at.17.55.15.mov

Pre-merge author checklist

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.

@david0xd david0xd self-assigned this Mar 21, 2025
@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.

@david0xd david0xd changed the base branch from main to sip-26 March 21, 2025 15:44
@david0xd david0xd force-pushed the dd/permission-connect-multichain-2 branch 4 times, most recently from c1bb79d to 962fcfe Compare March 21, 2025 16:24
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Going to move versions of these helpers into the @metamask/chain-agnostic-permission package in a subsequent PR

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
Copy link
Copy Markdown
Contributor

Closing in favor of #31326

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants