dethcrypto / dethcrypto/TypeChain

Typechain fails where there are no contracts in a shared parent directory

Open
#772 5 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

Here is a sample artifacts hierarchy structure to reproduce the bug:

```
contracts/1/interfaces/IOne.sol/IOne.json
contracts/2/interfaces/ITwo.sol/ITwo.json
```

Running typechain on a single directory works fine, `typechain --target ethers-v5 --out-dir './typechain' './contracts/1/**/*.json'` generates the following files:
```
./typechain/common.ts
./typechain/factories/index.ts
./typechain/factories/IOne__factory.ts
./typechain/index.ts
./typechain/IOne.ts
```

On the other hand, trying to generate the types for both contracts concurrently with `typechain --target ethers-v5 --out-dir './typechain' './contracts/**/*.json'` generates the following error:
```
Error occured: 'from' expected. (4:24)
2 | /* tslint:disable */
3 | /* eslint-disable */
> 4 | import type * as from './..';
| ^
5 | export type { };
6 | export * as 1 from './1';
7 | export * as 2 from './2';
```

and some files are generated outside the requested `out-dir`:

```
./1/interfaces/IOne.ts
./2/interfaces/ITwo.ts
./typechain/common.ts
```

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.