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

bug: ts-codegen fails to generate correct bindings #91

Open
abhimanyusinghgaur opened this issue Feb 15, 2023 · 3 comments
Open

bug: ts-codegen fails to generate correct bindings #91

abhimanyusinghgaur opened this issue Feb 15, 2023 · 3 comments

Comments

@abhimanyusinghgaur
Copy link

What is happening

Cw3 Fixed Multisig has Vote as both an ExecuteMsg and a QueryMsg:

When you generate the TS bindings for the Cw3 contract:

cosmwasm-ts-codegen
? [cmd] what do you want to do? generate
? [schema] which directory contains the the Rust contracts? ./schema
? [out] where is the output directory? ./ts
? [name] contract name? Cw3FixedMultisig
? [plugin] which plugins? client, message-composer
? [bundle] enable bundle? No

It ends up generating the bindings where the vote property on Cw3FixedMultisigReadOnlyInterface gets overridden by the vote property on Cw3FixedMultisigInterface with a different syntax.

Expectation

The Cw3 contract is correct. ts-codegen should be able to correctly handle this edge case when the names across Execute and Query msgs might conflict.

@pyramation
Copy link
Collaborator

pyramation commented Feb 22, 2023

the issue is that there is a duplicate named field, this is a known issue.

There are two solutions

  1. change the name of one of them (I think there are two vote methods, perhaps use vote and getVote)
  2. use the client.execExtendsQuery option here — this will create two separate clients though, so you'll have to manage those a bit more.

@abhimanyusinghgaur
Copy link
Author

Thanks. I went ahead with option 1. Will try option 2 as well.

But, overall, as a user, my expectation is that this issue should be handled within the default implementation somehow. So that I don't have to adapt to a custom solution just to resolve this.

@pyramation
Copy link
Collaborator

But, overall, as a user, my expectation is that this issue should be handled within the default implementation somehow. So that I don't have to adapt to a custom solution just to resolve this.

completely agree! I think we'd have to default to the option being the default, but many teams prefer to manage less clients. Perhaps we can look at creating scoped objects.

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

2 participants