-
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
feat: Add Multichain API to Flask #27782
base: main
Are you sure you want to change the base?
Conversation
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. |
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
👍 Dependency issues cleared. Learn more about Socket for GitHub ↗︎ This PR previously contained dependency changes with security issues that have been resolved, removed, or ignored. |
this PR needs the patches from here: https://github.com/MetaMask/metamask-extension/pull/27847/files#r1801195961 |
|
app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.js
Outdated
Show resolved
Hide resolved
app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.js
Outdated
Show resolved
Hide resolved
app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.js
Outdated
Show resolved
Hide resolved
app/scripts/lib/rpc-method-middleware/handlers/wallet-createSession/handler.js
Outdated
Show resolved
Hide resolved
Done here #29003 |
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/27940?quickstart=1) ## **Related issues** Fixes: #27782 (comment) ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/develop/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
❌ Multichain API Spec Test Failed. View the report here. |
New, updated, and removed dependencies detected. Learn more about Socket for GitHub ↗︎
🚮 Removed packages: npm/[email protected] |
❌ Multichain API Spec Test Failed. View the report here. |
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
@metamaskbot update-policies |
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
❌ Multichain API Spec Test Failed. View the report here. |
...ts/confirm/blockaid-loading-indicator/__snapshots__/blockaid-loading-indicator.test.tsx.snap
Show resolved
Hide resolved
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
The `extensionId` property was accidentally omitted by the ChromeDriver builder. This was an old mistake, made in #7690. You can see this property is expected in `test/e2e/webdriver/index.js`, though in practice we don't use this `extensionId` for anything right now. This was fixed so that we could use the `extensionId` in the future if necessary. This was extracted from #27782, which used this ID in some API spec e2e test helpers.
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
@@ -20,7 +20,6 @@ import { | |||
BRIDGE_PREFERRED_GAS_ESTIMATE, | |||
BRIDGE_QUOTE_MAX_RETURN_DIFFERENCE_PERCENTAGE, | |||
} from '../../../shared/constants/bridge'; | |||
import type { BridgeControllerState } from '../../../shared/types/bridge'; |
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.
Nit: This change seems unrelated to the rest of this PR
@@ -20,6 +21,12 @@ const createStaticServer = (options) => { | |||
public: path.resolve('./node_modules'), | |||
}); | |||
} | |||
|
|||
// Handle test-dapp-multichain URLs by removing the prefix |
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.
Nit: Link issue so readers can understand why we're doing this
// Handle test-dapp-multichain URLs by removing the prefix | |
// Handle test-dapp-multichain URLs by removing the prefix | |
// See here for details: https://github.com/MetaMask/MetaMask-planning/issues/4145 |
## **Description** The `extensionId` property was accidentally omitted by the ChromeDriver builder. This was an old mistake, made in #7690. You can see this property is expected in `test/e2e/webdriver/index.js`, though in practice we don't use this `extensionId` for anything right now. This was fixed so that we could use the `extensionId` in the future if necessary. This was extracted from #27782, which used this ID in some API spec e2e test helpers. [](https://codespaces.new/MetaMask/metamask-extension/pull/30444?quickstart=1) ## **Related issues** Extracted from #27782 ## **Manual testing steps** N/A ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
## Explanation This pull request fixes [this issue](MetaMask/MetaMask-planning#4263). We appear to be adding an `account` to the wallet scope Resulting in this failing [CI](https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/125517/workflows/abdfdb4f-da74-4cc2-9c2f-cf001817f358/jobs/4559282) for our [Multichain Flask PR](MetaMask/metamask-extension#27782) we should add it to the `wallet:eip155` scope (as currently done), but not just `wallet`. The fix involves refactoring [core](https://github.com/MetaMask/core) Multichain package so that creating the `scopeObjects` for each entry, we make sure that in `wallet` scope string, the accounts property is not populated. <!-- Thanks for your contribution! Take a moment to answer these questions so that reviewers have the information they need to properly understand your changes: * What is the current state of things and why does it need to change? * What is the solution your changes offer and how does it work? * Are there any changes whose purpose might not obvious to those unfamiliar with the domain? * If your primary goal was to update one package but you found you had to update another one along the way, why did you do so? * If you had to upgrade a dependency, why did you do so? --> ## References <!-- Are there any issues that this pull request is tied to? Are there other links that reviewers should consult to understand these changes better? Are there client or consumer pull requests to adopt any breaking changes? For example: * Fixes #12345 * Related to #67890 --> ## Changelog <!-- If you're making any consumer-facing changes, list those changes here as if you were updating a changelog, using the template below as a guide. (CATEGORY is one of BREAKING, ADDED, CHANGED, DEPRECATED, REMOVED, or FIXED. For security-related issues, follow the Security Advisory process.) Please take care to name the exact pieces of the API you've added or changed (e.g. types, interfaces, functions, or methods). If there are any breaking changes, make sure to offer a solution for consumers to follow once they upgrade to the changes. Finally, if you're only making changes to development scripts or tests, you may replace the template below with "None". --> ### `@metamask/package-a` - **<CATEGORY>**: Your change here - **<CATEGORY>**: Your change here ### `@metamask/package-b` - **<CATEGORY>**: Your change here - **<CATEGORY>**: Your change here ## 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 highlighted breaking changes using the "BREAKING" category above as appropriate - [ ] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes
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
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
The E2E test setup function (`withFixtures`) has been updated to pass the extension ID to E2E tests. This will be useful in the near future for testing the new multichain API, which is exposed over `externally_connectable` and requires the extension ID to use. This was extracted from #27782
@@ -227,6 +232,7 @@ async function withFixtures(options, testSuite) { | |||
mockedEndpoint, | |||
bundlerServer, | |||
mockServer, | |||
extensionId, |
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 has been extracted to this PR: #30539
I left out the variable refactor (the introduction of the wd
variable). Probably that was an attempt to clean this up, we have a confusing mix of similar variable names here. But we can clean that up in a follow-up instead. I think we can do something better to address that anyway (use webDriver
as the scoped variable, and remove the existing outer-scope webDriver
variable).
We appear to be adding an account to the `wallet` scope  Resulting in this failing CI for our [Multichain Flask PR](#27782) https://app.circleci.com/pipelines/github/MetaMask/metamask-extension/125517/workflows/abdfdb4f-da74-4cc2-9c2f-cf001817f358/jobs/4559282 we should add it to the `wallet:eip155` scope (as currently done), but not just wallet. The fix involves refactoring [core](https://github.com/MetaMask/core) `Multichain` package so that creating the `scopeObjects` for each entry, we make sure that in `wallet` scope string, the accounts property is not populated. <!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** <!-- Write a short description of the changes included in this pull request, also include relevant motivation and context. Have in mind the following questions: 1. What is the reason for the change? 2. What is the improvement/solution? --> [](https://codespaces.new/MetaMask/metamask-extension/pull/30495?quickstart=1) ## **Related issues** Fixes: ## **Manual testing steps** 1. Go to this page... 2. 3. ## **Screenshots/Recordings** <!-- If applicable, add screenshots and/or recordings to visualize the before and after of your change. --> ### **Before** <!-- [screenshots/recordings] --> ### **After** <!-- [screenshots/recordings] --> ## **Pre-merge author checklist** - [ ] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [ ] I've completed the PR template to the best of my ability - [ ] I’ve included tests if applicable - [ ] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [ ] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
❌ Multichain API Spec Test Failed. View the report here. |
## **Description** The E2E test setup function (`withFixtures`) has been updated to pass the extension ID to E2E tests. This will be useful in the near future for testing the new multichain API, which is exposed over `externally_connectable` and requires the extension ID to use. [](https://codespaces.new/MetaMask/metamask-extension/pull/30539?quickstart=1) ## **Related issues** This was extracted from #27782 ## **Manual testing steps** N/A, this isn't used yet so there is nothing to manually test. ## **Screenshots/Recordings** N/A ## **Pre-merge author checklist** - [x] I've followed [MetaMask Contributor Docs](https://github.com/MetaMask/contributor-docs) and [MetaMask Extension Coding Standards](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/CODING_GUIDELINES.md). - [x] I've completed the PR template to the best of my ability - [x] I’ve included tests if applicable - [x] I’ve documented my code using [JSDoc](https://jsdoc.app/) format if applicable - [x] I’ve applied the right labels on the PR (see [labeling guidelines](https://github.com/MetaMask/metamask-extension/blob/main/.github/guidelines/LABELING_GUIDELINES.md)). Not required for external contributors. ## **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.
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
Description
This branch adds support for the Multichain API to the Flask build of the Extension.
The existing API (via injected provider) should be completely unchanged.
(Very Briefly) What is the MetaMask Multichain API
externally_connectable
. Not accessible via an injected global likewindow.ethereum
Key Documents/Standards
mip = MetaMask Improvement Proposal
Manual testing steps
Then
(RECOMMENDED) Use the Multichain Test Dapp
OR
Form requests manually
Pre-merge author checklist
Pre-merge reviewer checklist