refactor!: Remove "data" event from SafeEventEmitterProvider#6328
refactor!: Remove "data" event from SafeEventEmitterProvider#6328
Conversation
9fa91bd to
f0f63aa
Compare
| this.#engine = engine; | ||
|
|
||
| if (engine.on) { | ||
| engine.on('notification', (message: string) => { |
There was a problem hiding this comment.
Your PR seems to imply that this isn't in use. Have you tested the extension with these lines stripped out?
There was a problem hiding this comment.
We searched for examples in all of our repos. We found a couple of uses, but only in test helpers.
I don't think it has been tested, that is a good idea though. We could probably delete this quickly in a patch, put it up as a draft, then see if CI passes.
|
Changes look good! Note this requirement from the PR template though:
If you could create a preview build, and a draft in each client that uses it, that would be greatly appreciated |
0f4e2d4 to
789d703
Compare
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
…#6796) ## Explanation As of #6328 `SafeEventEmitterProvider` no longer used the `EventEmitter` API, making its name misleading. Consequently, this PR renames it to `InternalProvider` and stops extending `SafeEventEmitter`. This new name better reflects its use as an internal-only provider that does not conform to any particular standard. `SafeEventEmitterProvider` is still exported as a deprecated alias of `InternalProvider` in order to circumvent build failures due to repo-external packages that use this alias. Once we have updated external packages to use `InternalProvider` instead, the old alias can be removed. ## References Closes #6594 ## 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] > Renames and replaces SafeEventEmitterProvider with InternalProvider across packages, updates proxies and types, adds a deprecated alias, and adjusts tests/changelogs accordingly. > > - **Provider (eth-json-rpc-provider)**: > - Add `InternalProvider` (no longer extends SafeEventEmitter); update `providerFromEngine`/`providerFromMiddleware` to return it. > - Export `SafeEventEmitterProvider` as a deprecated alias; update tests/exports; drop `@metamask/safe-event-emitter` dep. > - **Middleware (eth-json-rpc-middleware)**: > - Change provider types to `InternalProvider` in `block-ref`, `retryOnEmpty`, and `providerAsMiddleware`. > - **Block Tracker (eth-block-tracker)**: > - Expect `InternalProvider` in `PollingBlockTracker` and tests; update CHANGELOG (BREAKING). > - **Network Controller**: > - Switch provider type to `InternalProvider` across types/clients. > - Use `createSwappableProxy` for provider proxies; keep `createEventEmitterProxy` for block tracker; adjust handlers/comments and tests. > - **Selected Network Controller**: > - Use `createSwappableProxy` for provider proxy; align with `InternalProvider`; update tests. > - **Tests/Utilities**: > - Update `FakeProvider`/`FakeBlockTracker` and various tests to `InternalProvider`. > - **Changelogs**: > - Note BREAKING change across affected packages. > - **Misc**: > - Update ESLint thresholds and snapshots; lockfile changes reflect dependency removal. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit e1faf35. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: Elliot Winkler <elliot.winkler@gmail.com>
Explanation
The
SafeEventEmitterProvider'data'event relies on theJsonRpcEngine'notification'event, which per #6327 we are trying to get rid of. After failing to find an instance outside of tests where we actually use the'data'event, we assess that it can be removed.References
JsonRpcEngineV2#6327Checklist