Open PhilRandWu opened 10 months ago
I'm having the exact same issue on Lesson 07, when trying to deploy on Sepolia for the first time. I've been searching around but can't find a reason for this or tinker my way through to get the chainId, by defining anywhere else.
//hardhat-config.js
require("@nomicfoundation/hardhat-toolbox")
require("dotenv").config
require("@nomicfoundation/hardhat-verify")
require("hardhat-gas-reporter")
require("solidity-coverage")
require("hardhat-deploy")
/** @type import('hardhat/config').HardhatUserConfig */
const SEPOLIA_RPC_URL =
process.env.SEPOLIA_RPC_URL ||
"https://eth-sepolia.g.alchemy.com/v2/myappkey"
const PRIVATE_KEY =
process.env.PRIVATE_KEY ||
"myprivatekey"
const ETHERSCAN_API_KEY =
process.env.ETHERSCAN_API_KEY || "etherscanapikey"
const COINMARKETCAP_API_KEY =
process.env.COINMARKETCAP_API_KEY || "coimarketcapkey"
module.exports = {
solidity: {
compilers: [{ version: "0.8.8" }, { version: "0.6.6" }],
},
defaultNetwork: "hardhat",
networks: {
sepolia: {
url: SEPOLIA_RPC_URL,
chainId: 11155111,
accounts: [PRIVATE_KEY],
blockConfirmations: 6,
},
hardhat: {
chainId: 31337,
},
},
//helper-hardhat-config if relevant
const networkConfig = {
31337: {
name: "localhost",
},
// Price Feed Address, values can be obtained at https://docs.chain.link/data-feeds/price-feeds/addresses
11155111: {
name: "sepolia",
ethUsdPriceFeed: "0x694AA1769357215DE4FAC081bf1f309aDC325306",
},
}
const developmentChains = ["hardhat", "localhost"]
module.exports = { networkConfig, developmentChains }
//01-deploy-fund-me relevant chainId code
const { verifyMessage } = require("ethers")
const { networkConfig, developmentChains } = require("../helper-hardhat-config")
const { network } = require("hardhat")
const { verify } = require("../utils/verify")
require("dotenv").config()
module.exports = async ({ getNamedAccounts, deployments }) => {
const { deploy, log } = deployments
const { deployer } = await getNamedAccounts()
const chainId = network.config.chainId
let ethUsdPriceFeedAddress
if (chainId == 31337) {
const ethUsdAggregator = await deployments.get("MockV3Aggregator")
ethUsdPriceFeedAddress = ethUsdAggregator.address
} else {
ethUsdPriceFeedAddress = networkConfig[chainId]["ethUsdPriceFeed"]
}
Lesson
Lesson 13
Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")
No response
Operating System
Windows
Describe the bug
// hardhat.config.ts
// network.config.ts
It's just a call to the getWeth function,then Error: failed to get chainId, falling back on net_version... ConnectTimeoutError: Connect Timeout Error