-
Notifications
You must be signed in to change notification settings - Fork 118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Exporting Typechain definitions #4
Comments
you might need to add this to tsconfig
Not sure, might want to read on typescript/javascript. I am interested to know too :) |
I think you mean to add an Anyway I already tried and I got the same error. Furthermore I just noticed that I get the error only if I try to import a factory, if I directly import the "contract type" (exported by Typechain with This is weird since the error seems occurring at the beginning of the import, as soon as it tries to parse the typechain |
not in the sdk package, in the app using the sdk. |
Wait a moment, I think I said it badly. I've this situation:
The frontend doesn't directly interact with contracts, it imports the sdk, which in turn imports the contracts. Let exclude package C from the discussion since it has nothing to do with my problem, I tried putting your |
@aciceri have you tried just generating headers via |
I think this is the best hardhat template around, really cool, everything just working out of the box.
However, besides the smart contracts package, I'm also writing an SDK package that imports and use my contracts and I would like to use (and expose from my SDK) the typechain definitions too.
Despite I think this is a common use case I didn't find anyone doing so, how can I do?
For now I tried adding my contracts package as dev dependency in my sdk dependencies but when I try to import something with:
I get the following trying to run with
mocha --require ts-node/register 'src/test/**/*.ts'
It refers to the
export
in the autogenerated files by Typechain.Instead, if I import the typechain definitions specifying the path on my machine with
import {MyContract__factory} from 'absolute/path/to/my-package/typechain';
, it correcly works.I'm not sure the problem is related to this repository, maybe simply I'm not able to import the typechain definitions and in this case I apologize for writing here. But maybe, in some way, the changes to make my idea possible have to be done here. And I think it would be a really nice improvement.
The text was updated successfully, but these errors were encountered: