i'm trying to deploy my contract on ethereum sepolia network but encountered this error:
Error: sending a transaction requires a signer (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=contracts/5.7.0)
i have added const signer = provider.getSigner(); according to this answer on stackoverflow but the error is still there, here's my App.js code:
...
const loadBlockchainData = async () => {
try {
const provider = new ethers.providers.Web3Provider(window.ethereum)
setProvider(provider)
const signer = provider.getSigner();
const network = await provider.getNetwork()
const chainId = network.chainId;
const contractAddresses = config[chainId];
if(!contractAddresses) {
throw new Error(`No contract deployed to chain with id ${chainId}`);
}
const carbonCredit = new ethers.Contract(config[network.chainId].carbonCredit.address, CarbonCredit, provider)
const totalSupply = await carbonCredit.totalSupply()
const credits = []
for (var i = 1; i <= totalSupply; i++) {
const uri = await carbonCredit.tokenURI(i)
const response = await fetch(uri)
const metadata = await response.json()
credits.push(metadata)
}
setCredits(credits)
const escrow = new ethers.Contract(config[network.chainId].escrow.address, Escrow, provider)
setEscrow(escrow)
window.ethereum.on('accountsChanged', async () => {
const accounts = await window.ethereum.request({ method: 'eth_requestAccounts' });
const account = ethers.utils.getAddress(accounts[0])
setAccount(account);
})
} catch (error) {
console.error("Error loading blockchain data", error);
}
}
useEffect(() => {
loadBlockchainData()
}, [])
...

can anyone help me with this? i'm more than happy to provide more related code if you ask, any help would be awesome
i'm trying to deploy my contract on ethereum sepolia network but encountered this error:
Error: sending a transaction requires a signer (operation="sendTransaction", code=UNSUPPORTED_OPERATION, version=contracts/5.7.0)i have added
const signer = provider.getSigner();according to this answer on stackoverflow but the error is still there, here's my App.js code:can anyone help me with this? i'm more than happy to provide more related code if you ask, any help would be awesome