Skip to content

fix: SDK Connection when multichain account is selected#14494

Merged
owencraston merged 4 commits into
mainfrom
fix/sdk-connect-with-multichain-accounts
Apr 8, 2025
Merged

fix: SDK Connection when multichain account is selected#14494
owencraston merged 4 commits into
mainfrom
fix/sdk-connect-with-multichain-accounts

Conversation

@owencraston

@owencraston owencraston commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Description

This PR addresses an issue reported by @christopherferreira9. When connecting to the MetaMask SDK while your current selected account is a multichain account (solana, bitcoin etc), the AccountConnect component would not provide an account to be connected. The connect button was not disabled so when a user would press connect, it would fail since no account was selected. My solution is...

  1. create a new selector called selectPreviouslySelectedEvmAccount which returns the previously selected EVM account
  2. in the AccountConnect component, if the current chainId is non evm, set the initial selected account to the previously selected EVM account.
  3. The result is, when the user tries to connect to the SDK while their currently selected account is a Solana account, the user would still be prompted to connect their EVM account.
  4. Users can connect multi non evm accounts by clicking the "connect multiple accounts" button which will only show their EVM accounts.

Related issues

Fixes: #14426
Fixes #14427

Manual testing steps

  1. edit the .js.env file such that the METAMASK_BUILD_TYPE is set to beta
  2. yarn setup
  3. Build the branch on a real Physical device. Easiest option is to build the app using expo via runway. docs on this can be found here: https://github.com/MetaMask/metamask-mobile?tab=readme-ov-file#for-internal-developers
  4. Select Solana in the wallet
  5. Open this dapp on your desktop browser
  6. Click connect on the dapp
  7. Scan the QR Code with MetaMask -> The connection modal presents no accounts
  8. Accepting on this modal rejects the connection (see dapp console)

Screenshots/Recordings

Before

Screenshot 2025-04-07 at 7 11 29 PM
430308727-fccc3b02-e00f-487e-861b-18444334b989.mov

After

Phone cam

screen-20250407-184309.mp4

Laptop cam

Screen.Recording.2025-04-07.at.6.42.13.PM.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.

@github-actions

github-actions Bot commented Apr 8, 2025

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-accounts-framework Accounts team label Apr 8, 2025
@owencraston owencraston marked this pull request as ready for review April 8, 2025 04:09
@owencraston owencraston requested a review from a team as a code owner April 8, 2025 04:09
@owencraston owencraston force-pushed the fix/sdk-connect-with-multichain-accounts branch from 8f7dbc5 to cf3cb7d Compare April 8, 2025 04:10
@github-actions

github-actions Bot commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: b0c13ff9ed2be24d2d1fb8e0dc49c8d6d469c26f
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d3abf42c-3889-46b2-9574-489f93209d06

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@github-actions

github-actions Bot commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

❌❌❌ pr_smoke_e2e_pipeline failed on Bitrise! ❌❌❌

Commit hash: 5cf3751356722cde56b64c2a147f9eebbb203f02
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/b7ac0db9-dfdb-4b28-9b0d-ab94312f525c

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

Tip

  • Check the documentation if you have any doubts on how to understand the failure on bitrise

@owencraston owencraston enabled auto-merge April 8, 2025 17:31
@owencraston owencraston force-pushed the fix/sdk-connect-with-multichain-accounts branch from 5cf3751 to 242ce51 Compare April 8, 2025 18:03
@github-actions

github-actions Bot commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

https://bitrise.io/ Bitrise

✅✅✅ pr_smoke_e2e_pipeline passed on Bitrise! ✅✅✅

Commit hash: 242ce51
Build link: https://app.bitrise.io/app/be69d4368ee7e86d/pipelines/d4bf5fd3-f3a9-4c7a-a49c-b2553430309e

Note

  • You can kick off another pr_smoke_e2e_pipeline on Bitrise by removing and re-applying the Run Smoke E2E label on the pull request

@sonarqubecloud

sonarqubecloud Bot commented Apr 8, 2025

Copy link
Copy Markdown

@christopherferreira9

christopherferreira9 commented Apr 8, 2025

Copy link
Copy Markdown
Contributor

Working perfectly for SDK and WC on both inapp browser and from outside the MetaMask App.

@owencraston owencraston added this pull request to the merge queue Apr 8, 2025
Merged via the queue into main with commit 9d99899 Apr 8, 2025
@owencraston owencraston deleted the fix/sdk-connect-with-multichain-accounts branch April 8, 2025 19:21
@github-actions github-actions Bot locked and limited conversation to collaborators Apr 8, 2025
@metamaskbot metamaskbot added the release-7.45.0 Issue or pull request that will be included in release 7.45.0 label Apr 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

release-7.45.0 Issue or pull request that will be included in release 7.45.0 team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Inapp browser / WalletConnect unable to connect when Solana is selected [Bug]: SDK - unable to connect when Solana is selected

5 participants