Repository navigation
[pull] main from MetaMask:main - #222
Merged
Merged
Conversation
## Explanation These will be used indirectly by the `UserOperationController` to emulate adding and updating a transaction, in response to user operations. ## References This came up as a blocker to MetaMask/metamask-extension#31843 because currently the extension is directly publishing `TransactionController` events, which will no longer be allowed with the new messenger. ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Add `emulateNewTransaction` and `emulateTransactionUpdate` actions to TransactionController, emitting relevant swap/update events and updating state via messenger. > > - **Transaction Controller** > - **New Actions**: Add `TransactionController:emulateNewTransaction` and `TransactionController:emulateTransactionUpdate`. > - `emulateNewTransaction`: Publishes `TransactionController:transactionNewSwap` or `TransactionController:transactionNewSwapApproval` based on the transaction type. > - `emulateTransactionUpdate`: Sets `txParams.from` to the selected account, adds transaction if missing, updates it, and publishes `TransactionController:transactionStatusUpdated`. > - **Messenger**: Register handlers for `emulateNewTransaction` and `emulateTransactionUpdate`. > - **Exports**: Export new action types from `src/index.ts`. > - **Tests**: Add unit tests covering new actions, event publishing, and state updates. > - **Changelog**: Note added actions under Unreleased. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 357add4. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Pedro Figueiredo <pedro.figueiredo@consensys.net>
## Explanation Patch releases of most packages for the `base-controller` dependency update, and a few features and bug fixes. ## 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 --> ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Release 641.0.0 bumps many packages (notably network, polling, permission, preferences) and adds small features to Transaction, Keyring, and Accounts controllers. > > - **Release**: `641.0.0` > - **Features**: > - `@metamask/transaction-controller@60.10.0`: add actions `emulateNewTransaction` and `emulateTransactionUpdate`. > - `@metamask/keyring-controller@23.2.0`: add actions for `createNewVaultAndKeychain` and `createNewVaultAndRestore`. > - `@metamask/accounts-controller@33.2.0`: add `getAccounts` action. > - **Dependency updates (broad)**: > - Upgrade many packages to `@metamask/base-controller@^8.4.2`. > - Bump `@metamask/network-controller` to `24.3.1` and `@metamask/polling-controller` to `14.0.2` across dependents. > - Patch bumps for `@metamask/permission-controller@11.1.1`, `@metamask/preferences-controller@20.1.1`, `@metamask/phishing-controller@14.1.3`, `@metamask/remote-feature-flag-controller@1.9.1`, and others. > - **Changelogs**: Update package changelogs to reflect new versions and dependency bumps. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 6a7580d. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation Introduces `JsonRpcEngineV2` and `JsonRpcServer`, intended to replace all existing usage of the existing `JsonRpcEngine` implementation. For the motivation behind this change, see #6088 and/or [this ADR](https://github.com/MetaMask/decisions/blob/main/decisions/core/0013-json-rpc-engine-rewrite.md). ### Implementation In order to resolve the problems listed in the motivation, V2 engine is split in two: - `JsonRpcEngineV2` - Orchestrates middleware and composes sub-engines - JSON-RPC requests go in, result values (not JSON-RPC responses) come out - Re-throws middleware errors directly - `JsonRpcServer` - JSON-RPC requests go in, JSON-RPC responses come out - Accepts an `errorHandler` constructor parameter for capturing engine / middleware errors See the updated package `README.md` for details. ### Migration While this PR is substantial, migrating our existing JSON-RPC pipelines will be a significant project involving multiple teams over many releases cycles. To facilitate this, the PR introduces a forwards-compatibility adapter, `asV2Middleware()`, and backwards-compatibility adapter, `asLegacyMiddleware()`, for the legacy and V2 engines, respectively. In addition, all V2 exports are exposed under the `/v2` export path, making this update completely non-breaking (although all legacy exports are deprecated). ### Note to reviewers I recommend proceeding as follows: 0. Read the readme 1. `JsonRpcEngineV2` 2. `JsonRpcServer` 3. Compatibility adapter functions ## References - Closes #6088 - [ADR: Rewriting `JsonRpcEngine`](https://github.com/MetaMask/decisions/blob/main/decisions/core/0013-json-rpc-engine-rewrite.md) ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - ~I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes~ - Migrating our RPC pipelines left as an exercise to the reader. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduce `JsonRpcEngineV2` and `JsonRpcServer` with bidirectional adapters, deprecating the legacy engine, updating docs/exports/deps, and adding comprehensive tests. > > - **Core (v2)**: > - Add `JsonRpcEngineV2` with typed middleware pipeline, immutable request/result handling, and `MiddlewareContext`. > - Add `JsonRpcServer` for spec-compliant request/notification handling and error serialization. > - Provide adapters: `asLegacyMiddleware` (v2 -> legacy) and `asV2Middleware` (legacy -> v2). > - **Exports & Packaging**: > - Expose v2 under `@metamask/json-rpc-engine/v2` (ESM/CJS), add `v2.js` shim for Browserify. > - Update `package.json` exports and add deps (`deep-freeze-strict`, `klona`, `@types/deep-freeze-strict`). > - **Docs**: > - Rewrite root `README.md` to v2 usage; add legacy docs in `src/README.md` and mark legacy APIs as deprecated. > - Update `CHANGELOG.md`: Added v2; Deprecated legacy engine/types. > - **Legacy**: > - Annotate legacy engine/types with deprecation notes; minor internal tweaks (stringify util). > - **Tests**: > - Add extensive v2, server, and adapter tests; adjust legacy tests as needed. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit eca0e39. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
## Explanation In the `next` export of `base-controller`, the type `StatePropertyMetadataConstraint` mistakenly referenced the old metadata property name `anonymous` rather than `includeInDebugSnapshot`. The type has been updated to use the correct name. ## References Fixes a mistake introduced in #6593 ## Checklist - [x] I've updated the test suite for new or updated code as appropriate - [x] I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate - [x] I've communicated my changes to consumers by [updating changelogs for packages I've changed](https://github.com/MetaMask/core/tree/main/docs/contributing.md#updating-changelogs), highlighting breaking changes as necessary - [x] I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Corrects `StatePropertyMetadataConstraint` in the experimental `next` export to use `includeInDebugSnapshot` instead of `anonymous`, and updates the changelog. > > - **Type fix (experimental `next`)** > - Update `StatePropertyMetadataConstraint` in `packages/base-controller/src/next/BaseController.ts` to use `includeInDebugSnapshot` (replacing `anonymous`). > - **Changelog** > - Add Unreleased entry documenting the fix in `packages/base-controller/CHANGELOG.md`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 31f5c11. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY -->
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )