[Ethereum] Uncaught TypeError: web3.currentProvider.sendAsync is not a function

web3js

Calling web3.currentProvider.sendAsync raise an exception:

Uncaught TypeError: web3.currentProvider.sendAsync is not a function

Note: I faced this error when using https://www.npmjs.com/package/@digix/tempo. However, sendAsync is not a function inside web3.currentProvider when trying to check this with Web3 v1.0

Best Answer

Actually web3.currentProvider.sendAsync is depricated in Web3 v1.0 and it is replaced with web3.currentProvider.send.

So simply replace web3.currentProvider.sendAsync with web3.currentProvider.send when using Web3 v1.0.

For my case, I forked the "DigixGlobal tempo" repository from https://github.com/DigixGlobal/tempo, modified the code and made a pull request.

Related Topic