-
Notifications
You must be signed in to change notification settings - Fork 6
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
Issue generating types for ics721 #30
Comments
This issue is harder to fix since this is actually a type of wrapping I haven't considered before, see this. I'll try to address it this weekend. I don't think you should be needing a prefix, there is another solution for this in go, which is to use separate package names. Here is an example of using separate packages, where each directory contains the types for another contract. And it looks like this in usage. Does this work for you? |
@jhernandezb I've pushed a fix for the issue. I'm still not 100% sure that the custom Tuple types I've added will serialize/deserialize correctly. I've added some tests and json serde seems good. Feel free to create another issue if you run into json serde issues. I'll close this issue once you acknowledge the fix or enough time passes :) |
Thank you for this issue. Closing this now :) |
Worked perfectly thanks! I think it would be nice to generate an http client helper would you be open to add something like that?, I can see if I can do a PR but essentially we use it a lot with the grpc-web generated endpoints for cosmwasm func (c *Client) GetClassID(...) {
type queryResponse struct {
Response ics721.ClassId `json:"data"`
}
resp := &queryResponse{}
query := ics721.QueryMsg{
ClassId: &ics721.QueryMsg_ClassId{
Contract: collection,
},
}
err := c.SmartQuery(ctx, stargazeBridge, query, resp)
if err != nil {
return nil, err
}
...
} func (c *Client) SmartQuery(ctx context.Context, contract string, query any, v any) error {
bz, err := json.Marshal(query)
if err != nil {
return err
}
q := base64.StdEncoding.EncodeToString(bz)
queryUrl := fmt.Sprintf("%s/cosmwasm/wasm/v1/contract/%s/smart/%s", c.baseURL, contract, q)
return c.DoRequest(ctx, queryUrl, v)
} |
replied in #14 (comment) @jhernandezb |
Similar to the other issue looks like it can parse array
https://github.com/public-awesome/cw-ics721/blob/main/packages/ics721/schema/ics721.json
Would it be possible to pass a prefix when generating types? Ideally I'd like to have a single package and do something like
The text was updated successfully, but these errors were encountered: