Hi everyone, I’m trying to write a simple realm function where, using the ethers.js dependency, I get back the number of transactions in my ethereum wallet.
But I get an error when I try to use the function: toLowerCase() is not a function
Why? I leave you the code hoping to be able to solve …
exports = async function(arg){
var ethers = require("ethers");
const provider =
new ethers.providers.JsonRpcProvider("https://goerli.infura.io/XXXXXXXXXXXXXXXXXXXX");
const wallet = new ethers.Wallet("XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX", provider);
const gasPrice = await provider.getGasPrice(); //THIS WORKS FINE
console.log(gasPrice);
const nonce = await wallet.getTransactionCount(); //THIS THROWS THE ERROR toLowerCase() is not a function
console.log(nonce);
};