I tried to use 1337 as chainID on Hardhat to match metamask localhost 8545.
My hardhat.config.js have already included 1337 chainID for hardhat as below.
module.exports = { solidity: "0.8.17", networks: { hardhat: { chainId: 1337 } } };
As you can see above, I set chainId as 1337, but it didn't work and I got the below error when I try to use the contract's setGreeting function in frontend.
async function setGreeting() { if (!greeting) return if (typeof window.ethereum !== 'undefined') { await requestAccount() const provider = new ethers.providers.Web3Provider(window.ethereum) const signer = provider.getSigner() const contract = new ethers.Contract(greeterAddress, Greeter.abi, signer) const transaction = await contract.setGreeting(greeting) await transaction.wait() fetchGreeting() } }
Can you please inform me how to use 1337 instead of 31337 on Hardhat?