fix(connect-evm): normalize account request returns#297
Merged
Conversation
jiexi
previously approved these changes
May 15, 2026
ffmcgee725
approved these changes
May 18, 2026
This was referenced May 18, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Explanation
This fixes the EIP-1193 return shapes for intercepted Connect EVM account requests while preserving the existing request routing through the Connect EVM interceptor and
connect()flow.Previously,
provider.request({ method: 'eth_requestAccounts' })resolved to the higher-levelclient.connect()result:EIP-1193 consumers expect the method-specific result instead, so
eth_requestAccountsnow resolves to the accounts array:accountsThe same audit found
eth_coinbasesharing theeth_accountshandler and returning the full accounts array.eth_coinbasenow resolves to the selected account, whileeth_accountscontinues to resolve to the full accounts array.wallet_requestPermissionsintentionally keeps the existing Connect EVM return shape for this PR.References
provider.request()to resolve with the requested method's result.eth_requestAccountsresolves to an accounts array.Testing
yarn workspace @metamask/connect-evm test:unityarn tsc --noEmit -p packages/connect-evm/tsconfig.jsonChecklist