From 73cdd7f9e60c8bd5f6c01a65d349f41a79b72ea2 Mon Sep 17 00:00:00 2001 From: Alex992Y Date: Wed, 20 Mar 2024 23:46:07 +0000 Subject: [PATCH] for sepolia test for sepolia test --- basic/11-react-express-hardhat/README-CN.md | 4 +++- basic/11-react-express-hardhat/README.md | 5 ++++- .../frontend/src/components/Dapp.js | 2 +- basic/11-react-express-hardhat/hardhat.config.js | 8 ++------ basic/12-token-crowdfund/hardhat.config.js | 8 ++------ 5 files changed, 12 insertions(+), 15 deletions(-) diff --git a/basic/11-react-express-hardhat/README-CN.md b/basic/11-react-express-hardhat/README-CN.md index d31dfe956..4822d4304 100644 --- a/basic/11-react-express-hardhat/README-CN.md +++ b/basic/11-react-express-hardhat/README-CN.md @@ -9,6 +9,8 @@ ```shell yarn + +#Node 版本: v20.11.0 ``` - 选择创建一个简单的项目。添加一个名为 SimpleToken.sol 的合约到 ./contracts, 编译此合约并且运行测试 @@ -21,7 +23,7 @@ npx hardhat test - 部署 ```shell -npx hardhat run scripts/deploy.js --network goerli +npx hardhat run scripts/deploy.js --network sepolia ``` - 找到你的本地节点账户的私有 key 以及 token 地址,导入到 Metamask 中 diff --git a/basic/11-react-express-hardhat/README.md b/basic/11-react-express-hardhat/README.md index a86c4a4cd..17039ea78 100644 --- a/basic/11-react-express-hardhat/README.md +++ b/basic/11-react-express-hardhat/README.md @@ -9,6 +9,8 @@ ```shell yarn + +#Node Version: v20.11.0 ``` - Create a simple project selected. Add contract names SimpleToken.sol to ./contracts and compile the contract to run testing. @@ -34,10 +36,11 @@ yarn node app.js ``` -- Startup react +- Startup react (open new terminal) ```shell cd frontend +#Please ensure that it is already present the HARDHAT_NETWORK_ ID in src/components/Dapp.js has been modified to the corresponding network ID yarn yarn start ``` diff --git a/basic/11-react-express-hardhat/frontend/src/components/Dapp.js b/basic/11-react-express-hardhat/frontend/src/components/Dapp.js index b0788a1c6..3b68414e1 100644 --- a/basic/11-react-express-hardhat/frontend/src/components/Dapp.js +++ b/basic/11-react-express-hardhat/frontend/src/components/Dapp.js @@ -24,8 +24,8 @@ import { receipt_create, receipt_list} from '../api.js' // This is the Hardhat Network id, you might change it in the hardhat.config.js // Here's a list of network ids https://docs.metamask.io/guide/ethereum-provider.html#properties // to use when deploying to other networks. -const HARDHAT_NETWORK_ID = "42"; +const HARDHAT_NETWORK_ID = "11155111"; //sepolia network ID // This is an error code that indicates that the user canceled a transaction const ERROR_CODE_TX_REJECTED_BY_USER = 4001; diff --git a/basic/11-react-express-hardhat/hardhat.config.js b/basic/11-react-express-hardhat/hardhat.config.js index 3b741cafc..251c7916c 100644 --- a/basic/11-react-express-hardhat/hardhat.config.js +++ b/basic/11-react-express-hardhat/hardhat.config.js @@ -33,17 +33,13 @@ module.exports = { (you can put in a mnemonic here to set the deployer locally) */ }, - goerli: { - url: 'https://goerli.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) + sepolia: { + url: 'https://sepolia.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) accounts: [mnemonic()], }, mainnet: { url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) accounts: [mnemonic()], }, - ropsten: { - url: 'https://ropsten.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) - accounts: [mnemonic()], - }, }, }; diff --git a/basic/12-token-crowdfund/hardhat.config.js b/basic/12-token-crowdfund/hardhat.config.js index 0e5151a06..38a13f55b 100644 --- a/basic/12-token-crowdfund/hardhat.config.js +++ b/basic/12-token-crowdfund/hardhat.config.js @@ -44,17 +44,13 @@ module.exports = { (you can put in a mnemonic here to set the deployer locally) */ }, - goerli: { - url: 'https://goerli.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) + sepolia: { + url: 'https://sepolia.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) accounts: [mnemonic()], }, mainnet: { url: 'https://mainnet.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) accounts: [mnemonic()], }, - ropsten: { - url: 'https://ropsten.infura.io/v3/' + process.env.INFURA_ID, //<---- YOUR INFURA ID! (or it won't work) - accounts: [mnemonic()], - }, }, };