Calling sendAsync will be deprecated; we should use request instead.
It looks like getBlocksForRange.js makes a request for eth_getBlockByNumber using eth-query. We don't actually need eth-query for this; we can simply call the provider directly, using request.
We'll want to also update the tests. There is a test helper function, sendAsync, which is used in many of them. Similarly, we don't need this helper or eth-query; we can simply pass down the provider to where it needs to be used and use it directly.
Because of the above, we'll want to add @metamask/eth-json-rpc-provider as a dev dependency and remove @metamask/eth-query.
Because this library is still written in JavaScript, we should also add the new version of @metamask/eth-json-rpc-provider as a peer dependency to enforce that the middleware takes this new type of provider.
These changes should then be shipped under a new major version as they will be breaking.
This package uses eth-json-rpc-provider package from eth-block-tracker package. The similar changes to eth-block-tracker is in PR review. We need to wait until those changes gets merged and released.
After
SafeEventEmitterProvider
is updated to support EIP-1193 and a new version of@metamask/eth-json-rpc-provider
is released, we should adapt to the changes:sendAsync
will be deprecated; we should userequest
instead.getBlocksForRange.js
makes a request foreth_getBlockByNumber
usingeth-query
. We don't actually needeth-query
for this; we can simply call the provider directly, usingrequest
.sendAsync
, which is used in many of them. Similarly, we don't need this helper oreth-query
; we can simply pass down theprovider
to where it needs to be used and use it directly.@metamask/eth-json-rpc-provider
as a dev dependency and remove@metamask/eth-query
.Because this library is still written in JavaScript, we should also add the new version of@metamask/eth-json-rpc-provider
as a peer dependency to enforce that the middleware takes this new type of provider.