Skip to content

Commit

Permalink
feat: Make cosmwasm_schema deps obsolete
Browse files Browse the repository at this point in the history
  • Loading branch information
jawoznia committed Aug 23, 2024
1 parent b8aa9b0 commit 3ec395f
Show file tree
Hide file tree
Showing 45 changed files with 85 additions and 105 deletions.
16 changes: 0 additions & 16 deletions examples/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ edition = "2021"

[workspace.dependencies]
anyhow = "1.0.86"
cosmwasm-schema = "2.1.3"
cw-multi-test = "2.1.1"
cw-storage-plus = "2.0.0"
cw-utils = "2.0.0"
Expand Down
1 change: 0 additions & 1 deletion examples/contracts/custom/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ mt = ["library", "anyhow", "cw-multi-test"]

[dependencies]
cw1 = { path = "../../interfaces/cw1" }
cosmwasm-schema = { workspace = true }
cw-storage-plus = { workspace = true }
serde = { workspace = true }
sylvia = { path = "../../../sylvia" }
Expand Down
3 changes: 2 additions & 1 deletion examples/contracts/custom/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cosmwasm_schema::write_api;
use sylvia::cw_schema::write_api;

use custom::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg};

#[cfg(not(tarpaulin_include))]
fn main() {
write_api! {
crate_name: sylvia::cw_schema,
instantiate: InstantiateMsg,
execute: ContractExecMsg,
query: ContractQueryMsg,
Expand Down
8 changes: 4 additions & 4 deletions examples/contracts/custom/src/messages.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use cosmwasm_schema::cw_serde;
use sylvia::cw_schema::cw_serde;
use sylvia::cw_std::{CustomMsg, CustomQuery};

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct CountResponse {
pub count: u64,
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub enum CounterMsg {
Increment {},
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub enum CounterQuery {
Count {},
}
Expand Down
2 changes: 1 addition & 1 deletion examples/contracts/custom/src/multitest/custom_module.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use cosmwasm_schema::schemars::JsonSchema;
use sylvia::cw_schema::schemars::JsonSchema;
use cw_multi_test::{AppResponse, CosmosRouter, Module};
use cw_storage_plus::Item;
use serde::de::DeserializeOwned;
Expand Down
1 change: 0 additions & 1 deletion examples/contracts/cw1-subkeys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ mt = ["library", "cw-multi-test", "anyhow"]

[dependencies]
anyhow = { workspace = true, optional = true }
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion examples/contracts/cw1-subkeys/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cosmwasm_schema::write_api;
use cw1_subkeys::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg};
use sylvia::cw_schema::write_api;
use sylvia::cw_std::Empty;

#[cfg(not(tarpaulin_include))]
fn main() {
write_api! {
crate_name: sylvia::cw_schema,
instantiate: InstantiateMsg,
execute: ContractExecMsg<Empty, Empty>,
query: ContractQueryMsg<Empty, Empty>,
Expand Down
4 changes: 2 additions & 2 deletions examples/contracts/cw1-subkeys/src/responses.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::state::Permissions;
use cosmwasm_schema::schemars::JsonSchema;
use sylvia::cw_schema::schemars::JsonSchema;
use cw_utils::{Expiration, NativeBalance};
use serde::{Deserialize, Serialize};
use sylvia::cw_std::Addr;
Expand Down Expand Up @@ -43,7 +43,7 @@ impl AllowanceInfo {
/// ```
/// # use cw_utils::{Expiration, NativeBalance};
/// # use cw1_subkeys::msg::AllowanceInfo;
/// # use cosmwasm_schema::{cw_serde, QueryResponses};
/// # use sylvia::cw_schema::{cw_serde, QueryResponses};
/// # use sylvia::cw_std::coin;
///
/// let mut allows = vec![Allowance {
Expand Down
1 change: 0 additions & 1 deletion examples/contracts/cw1-whitelist/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ library = []
mt = ["sylvia/mt", "library", "cw-multi-test", "anyhow"]

[dependencies]
cosmwasm-schema = { workspace = true }
serde = { workspace = true }
sylvia = { path = "../../../sylvia" }
cw1 = { path = "../../interfaces/cw1" }
Expand Down
3 changes: 2 additions & 1 deletion examples/contracts/cw1-whitelist/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cosmwasm_schema::write_api;
use cw1_whitelist::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg};
use sylvia::cw_schema::write_api;
use sylvia::cw_std::Empty;

#[cfg(not(tarpaulin_include))]
fn main() {
write_api! {
crate_name: sylvia::cw_schema,
instantiate: InstantiateMsg,
execute: ContractExecMsg<Empty, Empty>,
query: ContractQueryMsg<Empty, Empty>,
Expand Down
1 change: 0 additions & 1 deletion examples/contracts/cw20-base/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mt = ["library", "cw-multi-test", "anyhow"]

[dependencies]
anyhow = { workspace = true, optional = true }
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion examples/contracts/cw20-base/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
use cosmwasm_schema::write_api;
use cw20_base::contract::sv::{ContractExecMsg, ContractQueryMsg, InstantiateMsg};
use sylvia::cw_schema::write_api;
use sylvia::cw_std::Empty;

#[cfg(not(tarpaulin_include))]
fn main() {
write_api! {
crate_name: sylvia::cw_schema,
instantiate: InstantiateMsg,
execute: ContractExecMsg<Empty, Empty>,
query: ContractQueryMsg<Empty, Empty>,
Expand Down
10 changes: 5 additions & 5 deletions examples/contracts/cw20-base/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::error::ContractError;
use crate::responses::{BalanceResponse, Cw20Coin, Cw20ReceiveMsg, TokenInfoResponse};
use crate::validation::{validate_accounts, validate_msg, verify_logo};
use cosmwasm_schema::cw_serde;
use sylvia::cw_schema::cw_serde;
use cw2::{ensure_from_older_version, set_contract_version};
use cw20_allowances::responses::AllowanceResponse;
use cw20_marketing::responses::{LogoInfo, MarketingInfoResponse};
Expand All @@ -22,7 +22,7 @@ use sylvia::entry_points;
const CONTRACT_NAME: &str = "crates.io:cw20-base";
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct TokenInfo {
pub name: String,
pub symbol: String,
Expand All @@ -37,22 +37,22 @@ impl TokenInfo {
}
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct MinterData {
pub minter: Addr,
/// cap is how many more tokens can be issued by the minter
pub cap: Option<Uint128>,
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct InstantiateMarketingInfo {
pub project: Option<String>,
pub description: Option<String>,
pub marketing: Option<String>,
pub logo: Option<Logo>,
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct InstantiateMsgData {
pub name: String,
pub symbol: String,
Expand Down
14 changes: 7 additions & 7 deletions examples/contracts/cw20-base/src/responses.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use cosmwasm_schema::cw_serde;
use sylvia::cw_schema::cw_serde;
use std::fmt;
use sylvia::cw_std::{to_json_binary, Addr, Binary, CosmosMsg, StdResult, Uint128, WasmMsg};

/// Cw20ReceiveMsg should be de/serialized under `Receive()` variant in a ExecuteMsg
#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct Cw20ReceiveMsg {
pub sender: String,
pub amount: Uint128,
Expand All @@ -30,12 +30,12 @@ impl Cw20ReceiveMsg {
}

// This is just a helper to properly serialize the above message
#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
enum ReceiverExecuteMsg {
Receive(Cw20ReceiveMsg),
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct Cw20Coin {
pub address: String,
pub amount: Uint128,
Expand All @@ -53,7 +53,7 @@ impl fmt::Display for Cw20Coin {
}
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct Cw20CoinVerified {
pub address: Addr,
pub amount: Uint128,
Expand All @@ -71,12 +71,12 @@ impl fmt::Display for Cw20CoinVerified {
}
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct BalanceResponse {
pub balance: Uint128,
}

#[cw_serde]
#[cw_serde(crate = "sylvia::cw_schema")]
pub struct TokenInfoResponse {
pub name: String,
pub symbol: String,
Expand Down
1 change: 0 additions & 1 deletion examples/contracts/entry-points-overriding/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ mt = ["library", "cw-multi-test", "anyhow"]

[dependencies]
anyhow = { workspace = true, optional = true }
cosmwasm-schema = { workspace = true }
cw-multi-test = { workspace = true, optional = true }
cw-storage-plus = { workspace = true }
cw-utils = { workspace = true }
Expand Down
3 changes: 2 additions & 1 deletion examples/contracts/entry-points-overriding/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
use cosmwasm_schema::write_api;
use sylvia::cw_schema::write_api;

use entry_points_overriding::contract::sv::{ContractQueryMsg, InstantiateMsg};
use entry_points_overriding::messages::{CustomExecMsg, SudoMsg};

#[cfg(not(tarpaulin_include))]
fn main() {
write_api! {
crate_name: sylvia::cw_schema,
instantiate: InstantiateMsg,
execute: CustomExecMsg,
query: ContractQueryMsg,
Expand Down
Loading

0 comments on commit 3ec395f

Please sign in to comment.