If I try to run the example given here: https://web3js.readthedocs.io/en/1.0/web3-eth.html#batchrequest
With the following code:
const batch = new web3.BatchRequest();
batch.add(web3.eth.getBalance.request('0x0000000000000000000000000000000000000000', 'latest'));
batch.execute()
.then(res => console.log(res))
.catch(err => console.log(err));
I get the error:
TypeError: method.callback is not a function
Does anybody have experience with this?
version:
"web3": "^1.0.0-beta.55"
Best Answer
For some reason (this is not documented anywhere I could find) the
request
method requires a callback function as a last parameter, as such: