-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
refactor: Support permitted chains on permission confirmation page #30443
base: main
Are you sure you want to change the base?
Conversation
4efb57b
to
ea31a68
Compare
Builds ready [ea31a68]
Page Load Metrics (1677 ± 85 ms)
Bundle size diffs
|
const requestedSessionsScopes = getRequestedSessionScopes( | ||
_request.permission, | ||
const requestedCaip25CaveatValue = getRequestedCaip25CaveatValue( | ||
_request.permissions, |
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.
Looks like this was the main problem - there is no _request.permission
. It's _request.permissions
. This always blanked out the requested chain IDs in the request.
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.
Yeah, we came across and fixed this in the extension
part of CAIP-25 merger refactor, but I haven't been able to get it reviewed and merged to main since the recent developments with the team unfortunately 😭
permissions?: PermissionsRequest, | ||
): Pick<Caip25CaveatValue, 'requiredScopes' | 'optionalScopes'> { | ||
): Caip25CaveatValue { |
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.
ty for this fix 🙏🏾 amidst the multiple requests to change how this function worked, I eventually must have forgotten to update the actual return value to include isMultichainOrigin
🤦🏾
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.
lgtm! 🚀
The permissions confirmation page currently ignores the `requestedChainIds` prop when the connection is confirmed. This hasn't resulted in a bug because this page is only used for snap permissions. Permission requests for `eth_account` or `endowment:permitted-chains` are handled by the "ChooseAccount" or "ConnectPage" components (the former if a snap is also requested alongside, the latter otherwise). This PR fixes the problem regardless, as it's confusing for the component to have this prop but to ignore it when processing the confirmation. This was extracted from #27782
ea31a68
to
e7bda56
Compare
4ec183d
Builds ready [4ec183d]
Page Load Metrics (1776 ± 90 ms)
Bundle size diffs
|
Description
The permissions confirmation page currently ignores the
requestedChainIds
prop when the connection is confirmed. This hasn't resulted in a bug because this page is only used for snap permissions. Permission requests foreth_account
orendowment:permitted-chains
are handled by the "ChooseAccount" or "ConnectPage" components (the former if a snap is also requested alongside, the latter otherwise).This PR fixes the problem regardless, as it's confusing for the component to have this prop but to ignore it when processing the confirmation.
This was extracted from #27782
Related issues
See this comment for some additional context: https://github.com/MetaMask/metamask-extension/pull/27782/files#r1936463248
Manual testing steps
N/A, the impacted functionality is unreachable.
Screenshots/Recordings
N/A
Pre-merge author checklist
Pre-merge reviewer checklist