Skip to content

Commit

Permalink
Merge pull request #93 from CosmWasm/larry/custom-msg
Browse files Browse the repository at this point in the history
Replace the `cw721::CustomMsg` trait with `cosmwasm_std::CustomMsg`
  • Loading branch information
JakeHartnell authored Oct 24, 2022
2 parents d27214e + 6a80da6 commit 1558c96
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 17 deletions.
3 changes: 1 addition & 2 deletions contracts/cw2981-royalties/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use cosmwasm_schema::cw_serde;
use cosmwasm_std::Uint128;
use cw721::CustomMsg;
use cosmwasm_std::{CustomMsg, Uint128};

#[cw_serde]
pub enum Cw2981QueryMsg {
Expand Down
4 changes: 2 additions & 2 deletions contracts/cw721-base/src/execute.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use serde::de::DeserializeOwned;
use serde::Serialize;

use cosmwasm_std::{Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult};
use cosmwasm_std::{Binary, CustomMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult};

use cw2::set_contract_version;
use cw721::{ContractInfoResponse, CustomMsg, Cw721Execute, Cw721ReceiveMsg, Expiration};
use cw721::{ContractInfoResponse, Cw721Execute, Cw721ReceiveMsg, Expiration};

use crate::error::ContractError;
use crate::msg::{ExecuteMsg, InstantiateMsg, MintMsg};
Expand Down
8 changes: 5 additions & 3 deletions contracts/cw721-base/src/query.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
use serde::de::DeserializeOwned;
use serde::Serialize;

use cosmwasm_std::{to_binary, Addr, Binary, BlockInfo, Deps, Env, Order, StdError, StdResult};
use cosmwasm_std::{
to_binary, Addr, Binary, BlockInfo, CustomMsg, Deps, Env, Order, StdError, StdResult,
};

use cw721::{
AllNftInfoResponse, ApprovalResponse, ApprovalsResponse, ContractInfoResponse, CustomMsg,
Cw721Query, Expiration, NftInfoResponse, NumTokensResponse, OperatorsResponse, OwnerOfResponse,
AllNftInfoResponse, ApprovalResponse, ApprovalsResponse, ContractInfoResponse, Cw721Query,
Expiration, NftInfoResponse, NumTokensResponse, OperatorsResponse, OwnerOfResponse,
TokensResponse,
};
use cw_storage_plus::Bound;
Expand Down
4 changes: 2 additions & 2 deletions contracts/cw721-base/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use serde::de::DeserializeOwned;
use serde::{Deserialize, Serialize};
use std::marker::PhantomData;

use cosmwasm_std::{Addr, BlockInfo, StdResult, Storage};
use cosmwasm_std::{Addr, BlockInfo, CustomMsg, StdResult, Storage};

use cw721::{ContractInfoResponse, CustomMsg, Cw721, Expiration};
use cw721::{ContractInfoResponse, Cw721, Expiration};
use cw_storage_plus::{Index, IndexList, IndexedMap, Item, Map, MultiIndex};

pub struct Cw721Contract<'a, T, C, E, Q>
Expand Down
2 changes: 1 addition & 1 deletion packages/cw721/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,4 @@ pub use crate::query::{
TokensResponse,
};
pub use crate::receiver::Cw721ReceiveMsg;
pub use crate::traits::{CustomMsg, Cw721, Cw721Execute, Cw721Query};
pub use crate::traits::{Cw721, Cw721Execute, Cw721Query};
8 changes: 1 addition & 7 deletions packages/cw721/src/traits.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use schemars::JsonSchema;
use serde::de::DeserializeOwned;
use serde::Serialize;

Expand All @@ -7,14 +6,9 @@ use crate::{
AllNftInfoResponse, ApprovalsResponse, ContractInfoResponse, NftInfoResponse,
NumTokensResponse, OperatorsResponse, OwnerOfResponse, TokensResponse,
};
use cosmwasm_std::{Binary, Deps, DepsMut, Empty, Env, MessageInfo, Response, StdResult};
use cosmwasm_std::{Binary, CustomMsg, Deps, DepsMut, Env, MessageInfo, Response, StdResult};
use cw_utils::Expiration;

// TODO: move this somewhere else... ideally cosmwasm-std
pub trait CustomMsg: Clone + std::fmt::Debug + PartialEq + JsonSchema {}

impl CustomMsg for Empty {}

pub trait Cw721<T, C>: Cw721Execute<T, C> + Cw721Query<T>
where
T: Serialize + DeserializeOwned + Clone,
Expand Down

0 comments on commit 1558c96

Please sign in to comment.