-
Notifications
You must be signed in to change notification settings - Fork 15
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
Aether Features #350
Aether Features #350
Conversation
Deploying cw-orchestrator with Cloudflare Pages
|
@@ -127,6 +127,23 @@ impl DaemonAsync { | |||
Ok(result) | |||
} | |||
|
|||
/// Query a contract. | |||
pub async fn query<Q: Serialize + Debug, T: Serialize + DeserializeOwned>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is copy-pasting the smart_query
from the AsyncWasmQuerier trait. Implement just once please
@@ -250,22 +250,19 @@ pub fn interface(attrs: TokenStream, input: TokenStream) -> TokenStream { | |||
} | |||
|
|||
#[cfg(not(target_arch = "wasm32"))] | |||
impl<Chain: ::cw_orch::prelude::CwEnv, #all_generics> ::cw_orch::prelude::InstantiableContract for #name<Chain, #all_generics> #all_debug_serialize { | |||
type InstantiateMsg = #init; | |||
impl<Chain, #all_generics> ::cw_orch::prelude::QueryableContract for #name<Chain, #all_generics> #all_debug_serialize { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you change the order of functions here ?
@@ -48,3 +48,11 @@ pub trait WasmQuerier: Querier { | |||
salt: cosmwasm_std::Binary, | |||
) -> Result<String, Self::Error>; | |||
} | |||
|
|||
pub trait AsyncWasmQuerier: Querier { | |||
async fn smart_query<Q: Serialize, T: DeserializeOwned>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about those clippy warnings ? Can we use async traits fn in traits now ? Nice
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah so we should add send bound for sure (as that enables multi-threaded application)
Also we can use this crate mentioned in that post to create a variant with / without the Send constraint: https://crates.io/crates/trait-variant
We might need this for the async -> sync wrapping that we do (i.e. use the non-send trait in that context). But the compiler will help us figure that out.
expand | ||
} | ||
|
||
pub fn async_query_fns_derive(input: ItemEnum) -> proc_macro2::TokenStream { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we have a common function with query_fns_derive, with only some differences (for maintainability) because this seems very close to the sync one
let expand = quote!( | ||
#derived_trait | ||
|
||
#derived_trait_impl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For instance here you need to target-flag this derive_trait_impl just like for the sync case. Better merge those into a common function
This is a very rough draft. We should sync on what we can cherry pick from this to include in cw-orch. |
Closing in favor of #413 |
Features required for the Abstract GraphQL Rust API.