Skip to content

feat: update usage of withKeyring to withKeyringV2 for EVM operations.#29638

Merged
hmalik88 merged 9 commits into
mainfrom
hm/mul-1541
May 9, 2026
Merged

feat: update usage of withKeyring to withKeyringV2 for EVM operations.#29638
hmalik88 merged 9 commits into
mainfrom
hm/mul-1541

Conversation

@hmalik88
Copy link
Copy Markdown
Contributor

@hmalik88 hmalik88 commented May 2, 2026

Description

Updates usage of withKeyring to withKeyringV2.

Note: Instances where withKeyring was not updated is considered to be dead code and will be removed in a follow up PR.

Changelog

CHANGELOG entry: null

Related issues

N/A

Manual testing steps

  1. Build from this branch.
  2. Ensure account ux is not affected (creating accounts, importing, using hardware wallets)

Screenshots/Recordings

N/A

Performance checks (if applicable)

  • I've tested on Android
    • Ideally on a mid-range device; emulator is acceptable
  • I've tested with a power user scenario
    • Use these power-user SRPs to import wallets with many accounts and tokens
  • I've instrumented key operations with Sentry traces for production performance metrics

For performance guidelines and tooling, see the Performance Guide.

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.

Note

Medium Risk
Updates the keyring access method used when importing/restoring mnemonics, which can impact account selection/address retrieval during onboarding and seedless flows. Limited scope but touches wallet import/authentication paths where regressions would be user-visible.

Overview
Switches mnemonic import flows to use KeyringController.withKeyringV2 when retrieving the first account address after creating a multichain wallet (in actions/multiSrp.importNewSecretRecoveryPhrase and Authentication.importSeedlessMnemonicToVault).

Removes the unused createNewSecretRecoveryPhrase action and its associated unit tests, and updates the multiSrp tests to mock withKeyringV2 accordingly.

Reviewed by Cursor Bugbot for commit 2e9b628. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 2, 2026

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.

@metamaskbotv2 metamaskbotv2 Bot added team-accounts-framework Accounts team INVALID-PR-TEMPLATE PR's body doesn't match template labels May 2, 2026
@github-actions github-actions Bot added the size-S label May 2, 2026
@hmalik88 hmalik88 marked this pull request as ready for review May 6, 2026 18:01
Copy link
Copy Markdown
Contributor

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 2e9b628. Configure here.

Comment thread app/core/Authentication/Authentication.ts Outdated
Comment thread app/actions/multiSrp/index.ts Outdated
@hmalik88 hmalik88 marked this pull request as draft May 6, 2026 19:37
@hmalik88 hmalik88 marked this pull request as ready for review May 6, 2026 20:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

🔍 Smart E2E Test Selection

  • Selected E2E tags: SmokeWalletPlatform, SmokeAccounts, SmokeIdentity, SmokeSeedlessOnboarding
  • Selected Performance tags: None (no tests recommended)
  • Risk Level: medium
  • AI Confidence: 88%
click to see 🤖 AI reasoning details

E2E Test Selection:
The changes involve two key modifications:

  1. app/actions/multiSrp/index.ts: Migrates importNewSecretRecoveryPhrase from KeyringController.withKeyring() to withKeyringV2(), which returns account objects {address} instead of plain address strings. All references updated from newAccountAddress (string) to newAccount.address. Also removes createNewSecretRecoveryPhrase function entirely (confirmed no remaining callers via grep).

  2. app/core/Authentication/Authentication.ts: Same withKeyringwithKeyringV2 migration in the seedless onboarding SRP import path.

Impact areas:

  • SmokeWalletPlatform: Multi-SRP wallet architecture is directly affected - importing additional Secret Recovery Phrases uses importNewSecretRecoveryPhrase, which is the core changed function. The ImportNewSecretRecoveryPhrase view component imports this function.
  • SmokeAccounts: Account management flows (creating accounts under different SRPs, account switching) are affected by the multi-SRP changes. Per tag description, when multi-SRP architecture changes, SmokeAccounts should be selected.
  • SmokeIdentity: Multi-SRP account synchronization is affected. Per tag description, when multi-SRP flows change, SmokeIdentity should be selected.
  • SmokeSeedlessOnboarding: Authentication.ts changes directly affect the seedless onboarding SRP import flow (importSeedlessOnboardingSrp method uses withKeyringV2). The SeedlessOnboardingController integration path is modified.

The removal of createNewSecretRecoveryPhrase is a breaking change if any callers existed, but grep confirmed no remaining callers. The withKeyringV2 API change is a behavioral change that could affect account address resolution in error recovery paths.

Performance Test Selection:
The changes are focused on API migration (withKeyring → withKeyringV2) and function removal in multi-SRP flows. These are correctness/behavioral changes, not performance-sensitive changes. No UI rendering, list components, data loading patterns, or app initialization paths are modified in ways that would impact performance metrics.

View GitHub Actions results

@sonarqubecloud
Copy link
Copy Markdown

sonarqubecloud Bot commented May 6, 2026

Copy link
Copy Markdown
Member

@gantunesr gantunesr left a comment

Choose a reason for hiding this comment

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

looks good. We should do a quick sanity check

@hmalik88
Copy link
Copy Markdown
Contributor Author

hmalik88 commented May 8, 2026

looks good. We should do a quick sanity check

Tested the flows, everything works

@hmalik88 hmalik88 added this pull request to the merge queue May 9, 2026
Merged via the queue into main with commit ba70f7b May 9, 2026
96 checks passed
@hmalik88 hmalik88 deleted the hm/mul-1541 branch May 9, 2026 00:35
@github-actions github-actions Bot locked and limited conversation to collaborators May 9, 2026
@metamaskbotv2 metamaskbotv2 Bot added the release-7.78.0 Issue or pull request that will be included in release 7.78.0 label May 9, 2026
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 release-7.78.0 Issue or pull request that will be included in release 7.78.0 size-S team-accounts-framework Accounts team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants