diff --git a/src/bin/schema.rs b/src/bin/schema.rs index da9d3fd8..c74eac7f 100644 --- a/src/bin/schema.rs +++ b/src/bin/schema.rs @@ -1,11 +1,21 @@ -use cosmwasm_schema::write_api; +use std::env::current_dir; +use std::fs::create_dir_all; + +use cosmwasm_schema::{export_schema, remove_schemas, schema_for}; use cw_otc_dex::msg::{ExecuteMsg, InstantiateMsg, QueryMsg}; +use cw_otc_dex::state::{Bid, Config, Deal}; fn main() { - write_api! { - instantiate: InstantiateMsg, - execute: ExecuteMsg, - query: QueryMsg, - } + let mut out_dir = current_dir().unwrap(); + out_dir.push("schema"); + create_dir_all(&out_dir).unwrap(); + remove_schemas(&out_dir).unwrap(); + + export_schema(&schema_for!(InstantiateMsg), &out_dir); + export_schema(&schema_for!(ExecuteMsg), &out_dir); + export_schema(&schema_for!(QueryMsg), &out_dir); + export_schema(&schema_for!(Config), &out_dir); + export_schema(&schema_for!(Deal), &out_dir); + export_schema(&schema_for!(Bid), &out_dir); } diff --git a/src/lib.rs b/src/lib.rs index 145edcfa..27831348 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -19,4 +19,5 @@ pub mod helpers; pub mod msg; pub mod state; -pub use crate::error::ContractError; +#[cfg(test)] +pub mod tests; \ No newline at end of file diff --git a/src/msg.rs b/src/msg.rs index 2a8f70ef..b97c92e9 100644 --- a/src/msg.rs +++ b/src/msg.rs @@ -69,8 +69,8 @@ pub enum ExecuteMsg { } /// Messages for querying contract state -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema, QueryResponses)] -#[serde(rename_all = "snake_case")] +#[cw_serde] +#[derive(QueryResponses)] pub enum QueryMsg { /// Get a specific deal by ID #[returns(DealResponse)]