dethcrypto / dethcrypto/TypeChain

typechain-hardhat does not consider hardhat 'sources' config

Open
#881 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
2.8k
Forks
376
PR merge metrics
No merged PRs in 30d

Description

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:

```ts
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...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.