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 constructor functions for use by cw-sdk #1558

Closed
wants to merge 2 commits into from
Closed

Add constructor functions for use by cw-sdk #1558

wants to merge 2 commits into from

Conversation

larry0x
Copy link
Contributor

@larry0x larry0x commented Dec 31, 2022

As pointed out by #1552, two query response types (bank::SupplyResponse and wasm::ContractInfoResponse) are marked as #[non_exhaustive] and thus cannot be constructed directly.

This is not a problem for wasmd, as they are created by deserialization. However for cw-sdk I do need to construct these responses in Rust code.

Simply adding a new function is not a satisfactory solution, as @webmaster128 pointed out, we would not be able to add new fields to the response type without changing the function signature.

The solution I'm going with here is to add an option cw_sdk feature, and the constructor functions only exist if cw_sdk feature is enabled.

@webmaster128
Copy link
Member

I think this is a better solution to the problem as it is more universal and does not make too many assumptions about the runtime that is trying to construct the query responses.

@larry0x
Copy link
Contributor Author

larry0x commented Jan 30, 2023

Closing this as #1560 is the preferred solution.

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

Successfully merging this pull request may close these issues.

2 participants