0

I'm using web3 version '^0.20.6' in my node application and did following for connecting to web3 but still getting the error while calling the method getTransactionCount.

const Web3 = require('web3');
const web3 = new Web3(new Web3.providers.HttpProvider(INFURA_ADDRESS));

// Got error while calling the below function
web3.eth.getTransactionCount(address).then(txCount => { }); 

Error : TypeError: web3.eth.getTransactionCount(...).then is not a function

4

web3 0.20.x is not using Promises, you need to provide a callback.

web3.eth.getTransactionCount(address, function(error, txCount) {
   // your code
}); 

ref

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.