foundry-rs / hardhat

Foundry-Hardhat plugins: Use Foundry for Hardhat projects
Other
93 stars 18 forks source link

Add a simple integration guide for @foundry-rs/hardhat #5

Open onbjerg opened 2 years ago

shawnharmsen commented 2 years ago
  1. nothing on npm yet so trying locally
  2. Documenting how to get it working locally for reference below

Steps to use locally

  1. clone https://github.com/foundry-rs/hardhat
  2. npm i && npm run build
  3. add local @foundry-rs/hardhat-anvil to package.json
{
  "name": "hardhat-project",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.6",
    "@nomiclabs/hardhat-waffle": "^2.0.3",
    "chai": "^4.3.6",
    "ethereum-waffle": "^3.4.4",
    "ethers": "^5.6.5",
    "hardhat": "^2.9.5",
    "@foundry-rs/hardhat-anvil": "file:/path/to/hardhat/packages/hardhat-anvil"
  }
}
  1. hardhat.config.js
    module.exports = {
    defaultNetwork: "anvil",
    anvil: {
    url: "http://127.0.0.1:8545/",
    launch: true, // if set to true, it will spawn a new instance if the plugin is initialized
    },

Troubleshooting

package.json main entry

Error: Cannot find module '...node_modules/@foundry-rs/hardhat-anvil/dist/src/index.js'. Please verify that the package.json has a valid "main" entry

npx hardhat node - anvil network value.url is missing

Error in plugin @nomiclabs/hardhat-anvil: Anvil network config is invalid: value.url is missing