Most web3.js
objects allow a callback as the last parameter, as well as returning promises to chain functions.
The error TypeError: e is not a function
means it is missing callback function.
In your case await
must work out of box, I'm thinking you're use it wrong, here is an example from documentation getBlockNumber()
:
web3.eth.getBlockNumber().then(console.log);
> 2744
If you still want use await
you must use it right, with async
keyword.
(async ()=> { await web3.eth.getBlockNumber(console.log) })()
> 2744
Looks ugly ya? That's javascript my friend.
Tip:
If you want the blocknumber you can use web3.eth.blockNumber
.