1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-23 02:10:12 +01:00
metamask-extension/patches/eth-query+2.1.2.patch
Elliot Winkler d7a812f42f
Add remaining tests for createInfuraClient (#15717)
Add tests for the `block-tracker-inspector` middleware — which makes
sure that the block tracker never has a reference to the latest block
which is less than a block number that shows up in an RPC method's
response — and the Infura middleware — which takes care of sending the
request to Infura, and will retry the request up to 5 times if Infura
sends back a certain type of error.

Note that the `retry-on-empty` middleware is not tested because it
currently has a [bug][1] which is making it ineffective.

[1]: https://github.com/MetaMask/eth-json-rpc-middleware/issues/139
2022-09-29 10:39:35 -06:00

24 lines
984 B
Diff

diff --git a/node_modules/eth-query/index.js b/node_modules/eth-query/index.js
index 13e9f3c..d714bb7 100644
--- a/node_modules/eth-query/index.js
+++ b/node_modules/eth-query/index.js
@@ -1,5 +1,6 @@
const extend = require('xtend')
const createRandomId = require('json-rpc-random-id')()
+const debug = require('debug')('eth-query');
module.exports = EthQuery
@@ -63,7 +64,10 @@ EthQuery.prototype.submitHashrate = generateFnFor('eth_subm
EthQuery.prototype.sendAsync = function(opts, cb){
const self = this
- self.currentProvider.sendAsync(createPayload(opts), function(err, response){
+ const payload = createPayload(opts)
+ debug('making request %o', payload)
+ self.currentProvider.sendAsync(payload, function(err, response){
+ debug('got err = %o, response = %o', err, response)
if (!err && response.error) err = new Error('EthQuery - RPC Error - '+response.error.message)
if (err) return cb(err)
cb(null, response.result)