Skip to content

typechain-hardhat does not consider hardhat 'sources' config #881

Description

@dhorkin

Hardhat allows you to move your contracts folder: https://hardhat.org/hardhat-runner/docs/config#path-configuration

When config.paths.sources is nonstandard, typechain-hardhat refuses to generate types.

for example:

const config: HardhatUserConfig = {
  solidity: "0.8.18",
  paths: {
    artifacts: "./hardhatstuff/artifacts",
    cache: "./hardhatstuff/artifacts/cache",
    sources: "./hardhatstuff/contracts",
  },
  typechain: {
    discriminateTypes: true,
    outDir: "./hardhatstuff/artifacts/typechain-types",
  },
};
➜  /workspace git:(master) ✗ npx hardhat clean && npx hardhat compile
Generating typings for: 3 artifacts in dir: ./hardhatstuff/artifacts/typechain-types for target: ethers-v6
Successfully generated 0 typings!
Compiled 3 Solidity files successfully (evm target: paris).
Versions:
        "@nomicfoundation/hardhat-ethers": "^3.0.4",
        "@nomicfoundation/hardhat-toolbox": "^3.0.0",
        "@openzeppelin/contracts": "^4.9.3",
        "@typechain/ethers-v6": "^0.4.3",
        "@typechain/hardhat": "^8.0.3",
        "ethers": "^6.7.1",
        "hardhat": "^2.18.0",
        "typechain": "^8.3.1"

Incidentally, it appears if I move it to the default location, compile, then move it back, subsequent compiles properly do types...

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions