I am getting the following error using ethers.js version 6 while getting the total transaction counts.

TypeError: wallet.getTransactionCount is not a function

3 Answers 3


in version 6 of ethers.js you should use getNonce() methoud

const nonce = await wallet.getNonce();

this is a link to the docs getNonce()


getTransactionCount is changed to getNonce in ethers.js version 6.

For ethers.js version 5;

const nonce = await wallet.getTransactionCount()

For ethers.js version 6;

const nonce = await wallet.getNonce()

In addition to Ali's answer, wallet in this case is a Signer.

From the docs, getNonce:

Gets the next nonce required for this Signer to send a transaction.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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