Skip to content

Commit

Permalink
feat: add schema for swapmap
Browse files Browse the repository at this point in the history
  • Loading branch information
ducphamle2 committed Dec 1, 2024
1 parent bab260a commit 4e15f69
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
12 changes: 12 additions & 0 deletions contracts/plus/swapmap/src/bin/schema.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use cosmwasm_schema::write_api;

use swapmap::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};

fn main() {
write_api! {
instantiate: InstantiateMsg,
execute: ExecuteMsg,
query: QueryMsg,
migrate: MigrateMsg
}
}
17 changes: 8 additions & 9 deletions contracts/plus/swapmap/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,23 +1,22 @@
use cosmwasm_std::{Binary, Addr};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use cosmwasm_schema::{cw_serde, QueryResponses};
use cosmwasm_std::{Addr, Binary};

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[cw_serde]
pub struct InstantiateMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[cw_serde]
pub struct MigrateMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[cw_serde]
pub enum ExecuteMsg {
ChangeOwner { owner: Addr },
AddTx { hash: Binary, value: Binary },
Ping {},
}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)]
#[serde(rename_all = "snake_case")]
#[cw_serde]
#[derive(QueryResponses)]
pub enum QueryMsg {
#[returns(Binary)]
GetTx { hash: Binary },
}

0 comments on commit 4e15f69

Please sign in to comment.