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

Add gRPC querier client generator #14

Closed
srdtrk opened this issue Feb 18, 2024 · 8 comments · Fixed by #37
Closed

Add gRPC querier client generator #14

srdtrk opened this issue Feb 18, 2024 · 8 comments · Fixed by #37
Labels
enhancement New feature or request
Milestone

Comments

@srdtrk
Copy link
Owner

srdtrk commented Feb 18, 2024

No description provided.

@srdtrk srdtrk added the enhancement New feature or request label Feb 18, 2024
@srdtrk srdtrk added the icebox Issues that will not be addressed for the time being label Apr 10, 2024
@srdtrk
Copy link
Owner Author

srdtrk commented Apr 30, 2024

#30 (comment)

Regarding this @jhernandezb. I have some code, that I haven't pushed yet which basically does this for queries. It uses gRPC directly instead of grpc-web. I am curious why you are using http and if pure gRPC would be ok?

Do you only need this for queries or also txs? Asking because queries are much easier to implement than txs because txs need to have wallet/key management.

@jhernandezb
Copy link

We use it mostly for querying added to our graphql so not really an issue if there is no tx support, the reason for using grpc-web or lcd/rest as some folks call it is that public endpoints for grpc are less common. Although we do have our own endpoints there is some cases where we query other chains public rpcs.

@srdtrk srdtrk removed the icebox Issues that will not be addressed for the time being label May 9, 2024
@srdtrk srdtrk added this to the v0.2.0 milestone May 9, 2024
@srdtrk
Copy link
Owner Author

srdtrk commented May 9, 2024

Will address this in the v0.2.0 release. Should come out very soon. This release will also include a testsuite generator based on interchaintest.

@jhernandezb
Copy link

Amazing thank you! looking forward to try this

@srdtrk
Copy link
Owner Author

srdtrk commented May 10, 2024

@jhernandezb, you can try it out now using this commit https://github.com/srdtrk/go-codegen/tree/e35b998da54333320fac5aa94ec4526217ec0de3 and give feedback before it's merged to main and released. Some commands have been reorganized, so you might want to get help using -h

@jhernandezb
Copy link

Have an issue trying to generate the client not sure if I'm doing it correctly

# success
go-codegen generate  messages cosmwasm/schemas/ics721/ics721.json -p ics721 -o cosmwasm/ics721/types.go

# fails
go-codegen generate  query-client cosmwasm/schemas/ics721/ics721.json -p ics721 -o cosmwasm/ics721/client.go
panic: cannot determine the type of cw721_admin

goroutine 1 [running]:
github.com/srdtrk/go-codegen/pkg/codegen.getResponseName({0x14000011ee0?, 0x14000011a50?}, 0x1400064a5a0)
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/pkg/codegen/querier.go:203 +0x188
github.com/srdtrk/go-codegen/pkg/codegen.generateQueryInterfaceFunc({0x14000011a50, 0x8}, {0x14000011ee0, 0xb}, 0x1400064a5a0)
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/pkg/codegen/querier.go:135 +0x8c
github.com/srdtrk/go-codegen/pkg/codegen.GenerateQueryClient(0x1400014c370, 0x14000629260, 0x6?)
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/pkg/codegen/querier.go:63 +0xfc
github.com/srdtrk/go-codegen/pkg/codegen.GenerateQueryClientFromIDLSchema({0x16b5eb341?, 0x104d02a64?}, {0x16b5eb372, 0x19}, {0x16b5eb368, 0x6})
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/pkg/codegen/querier.go:46 +0x240
github.com/srdtrk/go-codegen/cmd.genQueryCliCmd.func1(0x14000023208, {0x140000aa410, 0x4?, 0x104d00d4a?})
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/cmd/root_cmd.go:120 +0x90
github.com/spf13/cobra.(*Command).execute(0x14000023208, {0x140000aa3c0, 0x5, 0x5})
        /Users/jhernandez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:983 +0x840
github.com/spf13/cobra.(*Command).ExecuteC(0x14000022608)
        /Users/jhernandez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1115 +0x344
github.com/spf13/cobra.(*Command).Execute(0x14000074738?)
        /Users/jhernandez/go/pkg/mod/github.com/spf13/cobra@v1.8.0/command.go:1039 +0x1c
main.main()
        /Users/jhernandez/go/pkg/mod/github.com/srdtrk/go-codegen@v0.1.4-0.20240511173950-44677b08acf8/main.go:12 +0x20

@srdtrk
Copy link
Owner Author

srdtrk commented May 13, 2024

I made a fix. Thanks for pointing this out @jhernandezb, please try again with this commit https://github.com/srdtrk/go-codegen/tree/9b2a1a9452ffdf44b315f4d7bd517cc18727bd48

@srdtrk
Copy link
Owner Author

srdtrk commented May 17, 2024

I'm closing this now as the PR has been merged to main. I will soon tag a release, please create a new issue if there is still a problem

@srdtrk srdtrk closed this as completed May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants