-
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
Closed
Closed
Aether Features #350
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f7dc145
loosen trait bounds on Contract implementation
CyberHoward 289f74d
nit
CyberHoward a28039b
Merge branch 'main' into aether_changes
CyberHoward d4cfcf9
add async example
CyberHoward a7b4573
implement async query
CyberHoward 0804095
format
CyberHoward 908e430
Merge branch 'main' into aether_changes
Kayanski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// ANCHOR: full_counter_example | ||
use counter_contract::{ | ||
msg::InstantiateMsg, AsyncCounterQueryMsgFns, CounterContract, CounterExecuteMsgFns, | ||
}; | ||
use cw_orch::{anyhow, prelude::*, tokio}; | ||
use tokio::runtime::Runtime; | ||
|
||
const LOCAL_MNEMONIC: &str = "clip hire initial neck maid actor venue client foam budget lock catalog sweet steak waste crater broccoli pipe steak sister coyote moment obvious choose"; | ||
|
||
#[tokio::main] | ||
pub async fn main() -> anyhow::Result<()> { | ||
std::env::set_var("TEST_MNEMONIC", LOCAL_MNEMONIC); | ||
// ANCHOR: chain_construction | ||
dotenv::dotenv().ok(); // Used to load the `.env` file if any | ||
pretty_env_logger::init(); // Used to log contract and chain interactions | ||
|
||
let network = networks::UNI_6; | ||
let chain = DaemonAsyncBuilder::default().chain(network).build().await?; | ||
// ANCHOR_END: chain_construction | ||
|
||
// ANCHOR: contract_interaction | ||
|
||
let counter = CounterContract::new(chain); | ||
|
||
let count = counter.get_count().await?; | ||
assert_eq!(count.count, 1); | ||
// ANCHOR_END: clean_example | ||
// ANCHOR_END: contract_interaction | ||
|
||
Ok(()) | ||
} | ||
// ANCHOR_END: full_counter_example |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -123,7 +123,7 @@ The interface can be linked to its source code by implementing the `Uploadable` | |
```ignore | ||
use cw_orch::prelude::*; | ||
|
||
impl <Chain: CwEnv> Uploadable for Cw20<Chain> { | ||
impl <Chain> Uploadable for Cw20<Chain> { | ||
fn wrapper(&self) -> <Mock as cw_orch::TxHandler>::ContractSource { | ||
Box::new( | ||
ContractWrapper::new_with_empty( | ||
|
@@ -204,7 +204,7 @@ pub fn interface(attrs: TokenStream, input: TokenStream) -> TokenStream { | |
let name = cw_orch_struct.ident.clone(); | ||
let default_num = if let Some(id_expr) = default_id { | ||
quote!( | ||
impl <Chain: ::cw_orch::prelude::CwEnv, #all_generics> #name<Chain, #all_generics> { | ||
impl <Chain, #all_generics> #name<Chain, #all_generics> { | ||
pub fn new(chain: Chain) -> Self { | ||
Self( | ||
::cw_orch::contract::Contract::new(#id_expr, chain) | ||
|
@@ -214,7 +214,7 @@ pub fn interface(attrs: TokenStream, input: TokenStream) -> TokenStream { | |
) | ||
} else { | ||
quote!( | ||
impl <Chain: ::cw_orch::prelude::CwEnv, #all_generics> #name<Chain, #all_generics> { | ||
impl <Chain, #all_generics> #name<Chain, #all_generics> { | ||
pub fn new(contract_id: impl ToString, chain: Chain) -> Self { | ||
Self( | ||
::cw_orch::contract::Contract::new(contract_id, chain) | ||
|
@@ -228,7 +228,7 @@ pub fn interface(attrs: TokenStream, input: TokenStream) -> TokenStream { | |
#[derive( | ||
::std::clone::Clone, | ||
)] | ||
pub struct #name<Chain: ::cw_orch::prelude::CwEnv, #all_generics>(::cw_orch::contract::Contract<Chain>, #(#all_phantom_markers,)*); | ||
pub struct #name<Chain, #all_generics>(::cw_orch::contract::Contract<Chain>, #(#all_phantom_markers,)*); | ||
|
||
#[cfg(target_arch = "wasm32")] | ||
#[derive( | ||
|
@@ -240,7 +240,7 @@ pub fn interface(attrs: TokenStream, input: TokenStream) -> TokenStream { | |
#default_num | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<Chain: ::cw_orch::prelude::CwEnv, #all_generics> ::cw_orch::prelude::ContractInstance<Chain> for #name<Chain, #all_generics> { | ||
impl<Chain: ::cw_orch::environment::ChainState, #all_generics> ::cw_orch::prelude::ContractInstance<Chain> for #name<Chain, #all_generics> { | ||
fn as_instance(&self) -> &::cw_orch::contract::Contract<Chain> { | ||
&self.0 | ||
} | ||
|
@@ -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 commentThe reason will be displayed to describe this comment to others. Learn more. Why did you change the order of functions here ? |
||
type QueryMsg = #query; | ||
} | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<Chain: ::cw_orch::prelude::CwEnv, #all_generics> ::cw_orch::prelude::ExecutableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
type ExecuteMsg = #exec; | ||
impl<Chain, #all_generics> ::cw_orch::prelude::InstantiableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
type InstantiateMsg = #init; | ||
} | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<Chain: ::cw_orch::prelude::CwEnv, #all_generics> ::cw_orch::prelude::QueryableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
type QueryMsg = #query; | ||
impl<Chain, #all_generics> ::cw_orch::prelude::ExecutableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
type ExecuteMsg = #exec; | ||
} | ||
|
||
#[cfg(not(target_arch = "wasm32"))] | ||
impl<Chain: ::cw_orch::prelude::CwEnv, #all_generics> ::cw_orch::prelude::MigratableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
impl<Chain, #all_generics> ::cw_orch::prelude::MigratableContract for #name<Chain, #all_generics> #all_debug_serialize { | ||
type MigrateMsg = #migrate; | ||
} | ||
); | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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