i am getting this error
TypeError: Cannot read properties of null (reading 'sendTransaction')
when i run the following command :
yarn hardhat run scripts/deploy.js --network Sepolia
deploy.js :
const { ethers } = require("hardhat")
async function main() {
const SimpleStorageFactory = await ethers.getContractFactory(
"SimpleStorage"
)
console.log("Deploying the contract...")
const SimpleStorage = await SimpleStorageFactory.deploy()
await SimpleStorage.deployed()
console.log(`Contract deployed at address: ${SimpleStorage.address}`)
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error)
process.exit(1)
})
hardhat.config.js :
require("@nomicfoundation/hardhat-toolbox")
require("dotenv").config()
const SEPOLIA_RPC_URL = process.env.SEPOLIA_RPC_URL
const PRIVATE_KEY = process.env.PRIVATE_KEY
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
defaultNetwork: "hardhat",
networks: {
Sepolia: {
url: SEPOLIA_RPC_URL,
accounts: PRIVATE_KEY,
chainId: 11155111,
},
},
solidity: "0.8.18",
}
[PRIVATE_KEY]
There's one or more errors in your config file * Invalid account: #0 for network: Sepolia - Expected string, received undefined