Skip to content

Conversation

MoMannn
Copy link

@MoMannn MoMannn commented Oct 7, 2025

Explanation

This PR adds RPC methods for upgrading Externally Owned Accounts (EOAs) to EIP-7702 delegator accounts. This functions are only callable by preinstalled snaps. It adds

wallet_upgradeAccount for upgrading the account
wallet_getAccountUpgradeStatus for checking if account is upgraded or not

References

Needed for: MetaMask/metamask-extension#36452

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 communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Introduces @metamask/eip-7702-internal-rpc-middleware with wallet_upgradeAccount and wallet_getAccountUpgradeStatus, plus hooks, validation, tests, and repo metadata updates (README, CODEOWNERS, teams, tsconfig, graph).

  • New package: packages/@metamask/eip-7702-internal-rpc-middleware
    • Methods: wallet_upgradeAccount, wallet_getAccountUpgradeStatus (handlers, hooks)
    • Utilities: validateParams, validateAndNormalizeAddress, METHOD_NAMES, types
    • Tests/Config: Jest config and tests for methods/utils; package.json, TS configs, Typedoc, CHANGELOG.md, LICENSE
  • Monorepo updates:
    • README: Add package to list; graph updates; register eip_7702_internal_rpc_middleware
    • Graph edges: phishing_controller --> transaction_controller, signature_controller --> gator_permissions_controller
    • Ownership: .github/CODEOWNERS and teams.json entries for new package
    • Build refs: Add package to root tsconfig.build.json

Written by Cursor Bugbot for commit a92cc6f. This will update automatically on new commits. Configure here.

@MoMannn MoMannn requested a review from a team as a code owner October 7, 2025 11:56
cursor[bot]

This comment was marked as outdated.

jeffsmale90
jeffsmale90 previously approved these changes Oct 8, 2025
Copy link
Contributor

@jeffsmale90 jeffsmale90 left a comment

Choose a reason for hiding this comment

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

This looks great. A couple minor naming comments.

Copy link
Contributor

@mcmire mcmire left a comment

Choose a reason for hiding this comment

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

Did a brief pass, will do a round 2 later.

One question I had: Is it necessary to add internal-rpc within the package name? We didn't do that for eip-5792-middleware I notice.

@jeffsmale90
Copy link
Contributor

@mcmire

Is it necessary to add internal-rpc within the package name? We didn't do that for eip-5792-middleware I notice.

The reasoning for this is that these RPCs aren't strictly EIP-7702, they're internal RPCs for supporting EIP-7702, not intended for consumption by third parties.

validateParams(params, tuple([GetAccountUpgradeStatusParamsStruct]));

const [statusParams] = params as [GetAccountUpgradeStatusParams];
const { account, chainId } = statusParams;
Copy link
Contributor

Choose a reason for hiding this comment

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

did we want to enforce that the currently selected network for the request matches that of the request params?

Copy link
Author

Choose a reason for hiding this comment

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

Not sure if I completely understand the question. But the permission can be on any network as such we need to allow updating the account on any network. So independent on what the user has selected?

…UpgradeStatus.ts

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
cursor[bot]

This comment was marked as outdated.

MoMannn and others added 2 commits October 9, 2025 09:50
…UpgradeStatus.ts

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
cursor[bot]

This comment was marked as outdated.

MoMannn and others added 2 commits October 9, 2025 09:53
…ount.test.ts

Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
…ount.ts

Co-authored-by: Alex Donesky <adonesky@gmail.com>
cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

cursor[bot]

This comment was marked as outdated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants