Skip to content

Commit

Permalink
clean up examples
Browse files Browse the repository at this point in the history
  • Loading branch information
CyberHoward committed Jul 7, 2023
1 parent 922a71f commit c5a3193
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
8 changes: 2 additions & 6 deletions cw-orch/examples/daemon_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,12 @@ pub fn main() {
let runtime = Runtime::new().unwrap();

// We can now create a daemon. This daemon will be used to interact with the chain.
let res = Daemon::builder()
let daemon = Daemon::builder()
// set the network to use
.chain(networks::LOCAL_JUNO)
.handle(runtime.handle())
.mnemonic(LOCAL_MNEMONIC)
.build();

let Some(daemon) = res.as_ref().ok() else {
panic!("Error: {}", res.err().unwrap());
};
.build().unwrap();

let counter = CounterContract::new("local:counter", daemon.clone());

Expand Down
10 changes: 5 additions & 5 deletions cw-orch/examples/mock_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use cosmwasm_std::Addr;

use counter_contract::{
contract::CounterContract,
msg::{ExecuteMsg, GetCountResponse, InstantiateMsg, QueryMsg},
msg::{ExecuteMsg, GetCountResponse, InstantiateMsg, QueryMsg, ExecuteMsgFns, QueryMsgFns},
};
use cw_orch::prelude::{CwOrchExecute, CwOrchInstantiate, CwOrchQuery, CwOrchUpload, Mock};

Expand All @@ -14,14 +14,14 @@ pub fn main() {
let contract_counter = CounterContract::new("mock:contract_counter", mock);

let upload_res = contract_counter.upload();
assert!(upload_res.is_ok());
upload_res.unwrap();

let init_res = contract_counter.instantiate(&InstantiateMsg { count: 0 }, Some(&sender), None);
assert!(init_res.is_ok());
init_res.unwrap();

let exec_res = contract_counter.execute(&ExecuteMsg::Increment {}, None);
assert!(exec_res.is_ok());
exec_res.unwrap();

let query_res = contract_counter.query::<GetCountResponse>(&QueryMsg::GetCount {});
assert!(query_res.is_ok());
assert_eq!(query_res.unwrap().count,1);
}

0 comments on commit c5a3193

Please sign in to comment.