-
-
Notifications
You must be signed in to change notification settings - Fork 201
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
Make SafeEventEmitterProvider type-compatible with Ethereum request libraries #4095
Labels
Comments
This was referenced Mar 21, 2024
This was referenced Jun 13, 2024
cryptodev-2s
added a commit
that referenced
this issue
Jul 9, 2024
## Explanation After updating the [`SafeEventEmitterProvider` to support EIP-1193](#4095), I have made the following changes: - Deprecated the use of `sendAsync` and replaced it with the `request` method. - Updated instances in the `core` repository: - `NetworkController` tests - Modified areas where we previously expected the provider returned by NetworkController to have a `sendAsync` method. These now use the `request` method with the correct method signature: - `SelectedNetworkController` tests - `createAutoManagedNetworkClient` tests ## References * Fixes #4100 ## Changelog ## 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
This was referenced Jul 16, 2024
9 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
Currently, when an instance of SafeEventEmitterProvider is passed to the
Web3Provider
constructor from Ethers v5 or theBrowserProvider
constructor from Ethers v6, it produces a type error.Web3Provider
produces:and
BrowserProvider
produces:The first error happens because
Web3Provider
allowsjsonrpc
andid
to be missing from the request object, whereasJsonRpcRequest
does not; the second error happens becauseBrowserProvider
expects the provider to conform to EIP-1193, which specifies that it ought to have arequest
method.Proposed Solution
We can address both of these issues by:
request
method and deprecatingsend
andsendAsync
(which aren't part of the spec)request
does not requireid
andjsonrpc
to be set, filling them in if they are missingAcceptance Criteria
Web3Provider
constructor from Ethers v5BrowserProvider
constructor from Ethers v6eth-query
constructorethjs-query
constructorsend
andsendAsync
should produce deprecation warningseth-json-rpc-provider
tests should not usesend
andsendAsync
except where necessary to test the aboveThe text was updated successfully, but these errors were encountered: