最新版本引入是没引入hardhat-toolbox吗?全局安装的,文档又说这些依赖可以不用了。 hardhat.config.js:
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config({ path: ".env" });
const ALCHEMY_RPC_URL = process.env.ALCHEMY_KEY;
const PRIVATE_KEY = process.env.PRIVATE_KEY;
/** @type import('hardhat/config').HardhatUserConfig */
module.exports = {
solidity: "0.8.17",
networks: {
sepolia: {
url: ALCHEMY_RPC_URL,
accounts: [PRIVATE_KEY],
},
},
};
deploy.js:
const {
FlashbotsBundleProvider,
} = require("@flashbots/ethers-provider-bundle");
const { BigNumber } = require("ethers");
const { ethers } = require("hardhat");
require("dotenv").config({ path: ".env" });
const hre = require("hardhat");
async function main() {
const provider = new ethers.providers.JsonRpcProvider(process.env.ALCHEMY_KEY);
const signer = new ethers.Wallet(
process.env.PRIVATE_KEY,
provider
);
console.log("signer:",signer);
// Deploy Contract
const testNFTDeploy = await hre.ethers.deployContract("NftTest1");
await testNFTDeploy.deployed();
console.log("Address of NFT Contract:", testNFTDeploy.address);
}
main();