I'm trying to call a function of my contract deployed on testnet mumbai but I can't get it working. Here's the code
const ethers = require('ethers');
const addressOfContract = "0x09C7CC4593C4Fe030bf1704051fa9ED889A30cC7";
const baseURI = "ipfs://bafybeiad2zwj5cc7cazjnbpn4o7ggskeg2mbzz2cuybmqfud4e7pwvh6ha/"
const MyToken = require("../build/contracts/MyToken.json").abi;
const addressOwner = "0xeac9852225Aa941Fa8EA2E949e733e2329f42195";
const privateKey = process.env.MNEMONIC_WALLET.trim().toString();
async function mint() {
const wallet = new ethers.Wallet.fromMnemonic(privateKey);
const contract = new ethers.Contract(addressOfContract, MyToken, wallet);
let name = await contract.name();
console.log(name);
}
mint();
it gives me this error in the console:
reason: 'missing provider',
code: 'UNSUPPORTED_OPERATION',
operation: 'call'