-
-
Notifications
You must be signed in to change notification settings - Fork 250
Feat/eip 7702 internal rpc middleware #6789
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…b.com/MetaMask/core into feat/eip-7702-internal-rpc-middleware
There was a problem hiding this 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.
packages/eip-7702-internal-rpc-middleware/src/hooks/upgradeAccount.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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.
packages/eip-7702-internal-rpc-middleware/src/methods/wallet_getAccountUpgradeStatus.test.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/methods/wallet_getAccountUpgradeStatus.test.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/methods/wallet_getAccountUpgradeStatus.test.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/getAccountUpgradeStatus.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/getAccountUpgradeStatus.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/getAccountUpgradeStatus.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/upgradeAccount.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/upgradeAccount.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/hooks/upgradeAccount.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/methods/wallet_getAccountUpgradeStatus.ts
Outdated
Show resolved
Hide resolved
packages/eip-7702-internal-rpc-middleware/src/methods/wallet_upgradeAccount.ts
Outdated
Show resolved
Hide resolved
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; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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>
…UpgradeStatus.ts Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
…ount.test.ts Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
…ount.ts Co-authored-by: Alex Donesky <adonesky@gmail.com>
…b.com/MetaMask/core into feat/eip-7702-internal-rpc-middleware
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
Note
Introduces
@metamask/eip-7702-internal-rpc-middleware
withwallet_upgradeAccount
andwallet_getAccountUpgradeStatus
, plus hooks, validation, tests, and repo metadata updates (README, CODEOWNERS, teams, tsconfig, graph).packages/@metamask/eip-7702-internal-rpc-middleware
wallet_upgradeAccount
,wallet_getAccountUpgradeStatus
(handlers, hooks)validateParams
,validateAndNormalizeAddress
,METHOD_NAMES
, typespackage.json
, TS configs, Typedoc,CHANGELOG.md
,LICENSE
eip_7702_internal_rpc_middleware
phishing_controller --> transaction_controller
,signature_controller --> gator_permissions_controller
.github/CODEOWNERS
andteams.json
entries for new packagetsconfig.build.json
Written by Cursor Bugbot for commit a92cc6f. This will update automatically on new commits. Configure here.