Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use cw_orch::prelude::*;
use cw20::{Cw20Coin, BalanceResponse};

// Implement the Uploadable trait so it can be uploaded to the mock.
impl <Chain: CwEnv> Uploadable for Cw20<Chain> {
impl <Chain> Uploadable for Cw20<Chain> {
fn wrapper(&self) -> Box<dyn MockContract<Empty>> {
Box::new(
ContractWrapper::new_with_empty(
Expand Down Expand Up @@ -132,7 +132,7 @@ The generated functions can then be used for any interface that uses this `Execu
#[cw_orch::interface(Empty,ExecuteMsg,Empty,Empty)]
struct Cw1<Chain>;

impl<Chain: CwEnv> Cw1<Chain> {
impl<Chain> Cw1<Chain> {
pub fn test_macro(&self) {
// Enjoy the nice API!
self.freeze().unwrap();
Expand Down
2 changes: 1 addition & 1 deletion contracts/counter/src/interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct CounterContract;
// ANCHOR_END: interface_macro

// ANCHOR: uploadable_impl
impl<Chain: CwEnv> Uploadable for CounterContract<Chain> {
impl<Chain> Uploadable for CounterContract<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(&self) -> WasmPath {
artifacts_dir_from_workspace!()
Expand Down
2 changes: 1 addition & 1 deletion contracts/counter/tests/checksum.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ fn checksum() {
let lines = io::BufReader::new(file).lines();
let mut found = false;

for line in lines.flatten() {
for line in lines.map_while(Result::ok) {
if line.contains("counter_contract.wasm") {
let parts: Vec<&str> = line.split_whitespace().collect();
if parts.len() > 1 {
Expand Down
2 changes: 1 addition & 1 deletion contracts/mock_contract/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ pub struct MockContract;
pub mod interface {
use super::*;

impl<Chain: cw_orch::prelude::CwEnv> cw_orch::prelude::Uploadable for MockContract<Chain> {
impl<Chain> cw_orch::prelude::Uploadable for MockContract<Chain> {
fn wrapper(
&self,
) -> Box<dyn cw_orch::prelude::MockContract<cosmwasm_std::Empty, cosmwasm_std::Empty>>
Expand Down
4 changes: 2 additions & 2 deletions contracts/mock_contract/src/msg_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,13 @@ mod interface {
use super::*;
use cw_orch::prelude::*;

impl<Chain: CwEnv> Uploadable for TestContract<Chain> {
impl<Chain> Uploadable for TestContract<Chain> {
fn wrapper(&self) -> <Mock as TxHandler>::ContractSource {
Box::new(ContractWrapper::new_with_empty(execute, instantiate, query))
}
}

impl<Chain: CwEnv> Uploadable for OrderedTestContract<Chain> {
impl<Chain> Uploadable for OrderedTestContract<Chain> {
fn wrapper(&self) -> <Mock as TxHandler>::ContractSource {
Box::new(ContractWrapper::new_with_empty(
execute_ordered,
Expand Down
4 changes: 1 addition & 3 deletions contracts/mock_contract_u64/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,7 @@ pub mod interface {
#[cw_orch::interface(InstantiateMsg, ExecuteMsg<T>, QueryMsg<Q>, MigrateMsg, id = "mock-contract")]
pub struct MockContract<Chain, T, Q>;

impl<Chain: cw_orch::prelude::CwEnv> cw_orch::prelude::Uploadable
for MockContract<Chain, u64, u64>
{
impl<Chain> cw_orch::prelude::Uploadable for MockContract<Chain, u64, u64> {
fn wrapper(
&self,
) -> Box<dyn cw_orch::prelude::MockContract<cosmwasm_std::Empty, cosmwasm_std::Empty>>
Expand Down
2 changes: 1 addition & 1 deletion cw-orch-daemon/src/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ mod tests {
#[tokio::test]
async fn no_connection() {
let mut chain = cw_orch_daemon::networks::LOCAL_JUNO;
let grpcs = &vec!["https://127.0.0.1:99999"];
let grpcs = &["https://127.0.0.1:99999"];
chain.grpc_urls = grpcs;

let build_res = DaemonAsync::builder()
Expand Down
7 changes: 2 additions & 5 deletions cw-orch/src/snapshots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,7 @@ pub mod tests {
use crate::mock::cw_multi_test::ContractWrapper;
use cosmwasm_std::Empty;
use cw_orch::prelude::{CwOrchInstantiate, CwOrchUpload, Mock};
use cw_orch_core::{
contract::{interface_traits::Uploadable, WasmPath},
environment::CwEnv,
};
use cw_orch_core::contract::{interface_traits::Uploadable, WasmPath};

#[test]
fn contract_snapshots() -> anyhow::Result<()> {
Expand Down Expand Up @@ -86,7 +83,7 @@ pub mod tests {
)]
pub struct CounterContractWithId;

impl<Chain: CwEnv> Uploadable for CounterContractWithId<Chain> {
impl<Chain> Uploadable for CounterContractWithId<Chain> {
/// Return the path to the wasm file corresponding to the contract
fn wasm(&self) -> WasmPath {
unimplemented!()
Expand Down
4 changes: 2 additions & 2 deletions cw-orch/tests/interface_macro.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use cw_orch::{
environment::{CwEnv, TxHandler},
environment::TxHandler,
prelude::{ContractWrapper, Uploadable},
};

Expand All @@ -22,7 +22,7 @@ use cw_orch::interface;
)]
pub struct MockContract;

impl<Chain: CwEnv> Uploadable for MockContract<Chain> {
impl<Chain> Uploadable for MockContract<Chain> {
fn wrapper(&self) -> <Mock as TxHandler>::ContractSource {
Box::new(
ContractWrapper::new_with_empty(
Expand Down
4 changes: 2 additions & 2 deletions cw-orch/tests/interface_macro_generics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cw_orch::{environment::CwEnv, interface, prelude::*};
use cw_orch::{interface, prelude::*};
use mock_contract::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

use cosmwasm_std::Event;
Expand All @@ -7,7 +7,7 @@ use cw_orch::prelude::Mock;
#[interface(InstantiateMsg, ExecuteMsg<T>, QueryMsg, MigrateMsg, id = "test:mock_contract")]
pub struct MockContract;

impl<Chain: CwEnv, T> Uploadable for MockContract<Chain, T> {
impl<Chain, T> Uploadable for MockContract<Chain, T> {
fn wrapper(&self) -> <Mock as TxHandler>::ContractSource {
Box::new(
ContractWrapper::new_with_empty(
Expand Down
4 changes: 2 additions & 2 deletions docs/src/interchain/quick-start.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ The `Client` and `Host` structures here are [cw-orchestrator Contracts](../contr
)]
struct Client;

impl<Chain: CwEnv> Uploadable for Client<Chain> {
impl<Chain> Uploadable for Client<Chain> {
// No wasm needed for this example
// You would need to get the contract wasm to be able to interact with actual Cosmos SDK nodes
fn wasm(&self) -> WasmPath {
Expand Down Expand Up @@ -99,7 +99,7 @@ pub fn host_execute(_: DepsMut, _: Env, _: MessageInfo, _: Empty) -> StdResult<R
)]
struct Host;

impl<Chain: CwEnv> Uploadable for Host<Chain> {
impl<Chain> Uploadable for Host<Chain> {
// No wasm needed for this example
// You would need to get the contract wasm to be able to interact with actual Cosmos SDK nodes
fn wasm(&self) -> WasmPath {
Expand Down
2 changes: 1 addition & 1 deletion docs/src/setup/workspace/deploy.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ The deployment can be represented by a struct containing all the contracts that

```rust,ignore
// Our Abstract deployment
pub struct Abstract<Chain: CwEnv> {
pub struct Abstract<Chain> {
pub ans_host: AnsHost<Chain>,
pub version_control: VersionControl<Chain>,
}
Expand Down
26 changes: 13 additions & 13 deletions packages/cw-orch-contract-derive/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,9 @@ This generated the following code:
```ignore

// This struct represents the interface to the contract.
pub struct Cw20<Chain: ::cw_orch::prelude::CwEnv>(::cw_orch::prelude::Contract<Chain>);
pub struct Cw20<Chain>(::cw_orch::prelude::Contract<Chain>);

impl <Chain: ::cw_orch::prelude::CwEnv> Cw20<Chain> {
impl <Chain> Cw20<Chain> {
/// Constructor for the contract interface
pub fn new(contract_id: impl ToString, chain: Chain) -> Self {
Self(
Expand All @@ -107,10 +107,10 @@ impl <Chain: ::cw_orch::prelude::CwEnv> Cw20<Chain> {
}

// Traits for signaling cw-orchestrator with what messages to call the contract's entry points.
impl <Chain: ::cw_orch::prelude::CwEnv> ::cw_orch::prelude::InstantiableContract for Cw20<Chain> {
impl <Chain> ::cw_orch::prelude::InstantiableContract for Cw20<Chain> {
type InstantiateMsg = InstantiateMsg;
}
impl <Chain: ::cw_orch::prelude::CwEnv> ::cw_orch::prelude::ExecutableContract for Cw20<Chain> {
impl <Chain> ::cw_orch::prelude::ExecutableContract for Cw20<Chain> {
type ExecuteMsg = ExecuteMsg;
}
// ... other entry point & upload traits
Expand All @@ -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(
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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(
Expand All @@ -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
}
Expand All @@ -250,22 +250,22 @@ 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 {
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::ExecutableContract for #name<Chain, #all_generics> #all_debug_serialize {
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::QueryableContract for #name<Chain, #all_generics> #all_debug_serialize {
impl<Chain, #all_generics> ::cw_orch::prelude::QueryableContract for #name<Chain, #all_generics> #all_debug_serialize {
type QueryMsg = #query;
}

#[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;
}
);
Expand Down
Loading