types: export EIP1193Provider and LegacyEthereumProvider interfaces
Description
This exports two new TypeScript declarations:
-
EIP1993Provider: Encodes a provider forEIP1993 -
LegacyEthereumProvider: Encodes a legacy Ethereum JSON RPC provider. Based on original work in https://github.com/MetaMask/eth-json-rpc-provider/pull/14
Motivation
As far as I know, there is no common explicit interface for the de-facto interface implemented by various Ethereum Json RPC providers. Across the MetaMask npm packages, there are currently use of differing implementations with mostly overlapping interfaces.
This PR introduces a common interface that can be applied regardless of implementations and used in MetaMask packages.
Example of situation where this will be useful
- https://github.com/MetaMask/nonce-tracker/pull/39/files#diff-32c87e191294c6b28ce5bdbc2b2052f6810d981faf6c323ebb1982a2f370a84aL108
- https://github.com/MetaMask/core/pull/1653/commits/4d4a8d4b2024f6f38766b0118a4f458854aef1ae
No top level dependency changes detected. Learn more about Socket for GitHub ↗︎
👍 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.
@SocketSecurity ignore @metamask/[email protected]
In Snaps we typically just import
MetaMaskInpageProviderfrom@metamask/providersto get types for this. Do you think it's useful to export this from@metamask/utils?
~MetaMaskInpageprovider is a class which would satisfy the interface here.~ The intention here is to supply that common interface that can be used regardless of implementation when interfacing with internal providers like EthQuery et al.
Related: https://github.com/MetaMask/eth-json-rpc-provider/pull/14
looks good. I think we can do without EthJsonRpcProvider as I don't see when we would use the extra properties being defined
Updated:
- Removed
EthJsonRpcProvider - Added
LegacyEthereumProvider- Unification of https://github.com/MetaMask/eth-json-rpc-provider/pull/14/files#diff-eb5ad9e4a58317c1917e5ce8ce71ffca663c150c81ad4ed36706d7295821249dR10 and https://github.com/MetaMask/eth-query/blob/main/index.d.ts
@SocketSecurity ignore [email protected]
@SocketSecurity ignore @ethersproject/[email protected]
@SocketSecurity ignore [email protected]
Nobody appears to be championing this anymore.