Skip to content
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

deployProxy function does not return correct contract type #1082

Open
ryanc-bs opened this issue Sep 17, 2024 · 2 comments
Open

deployProxy function does not return correct contract type #1082

ryanc-bs opened this issue Sep 17, 2024 · 2 comments

Comments

@ryanc-bs
Copy link

I've encountered an issue using the deployProxy method with TypeScript.

When deployed without a proxy using ethers.deployContract, TypeScript is able to infer the correct type for the contract being deployed. For example, if I have a contract named MyContract with method foo then calling ethers.deployContract returns a MyContract instance with the required foo method.

This breaks when using deployProxy - instead of returning the correct contract type according to the factory type, it returns a generic Contract object which needs to be explicitly cast into the correct contract type from typechain-types.

Would it be possible to update deployProxy so that the correct type can be automatically inferred from the factory to avoid this ugly casting?

@ericglau
Copy link
Member

Related to #535. As that PR hasn't had recent activity, this may be open to contribution if anyone is interested in picking it up.

@robertmagier
Copy link

I will do it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants