diff --git a/Cargo.toml b/Cargo.toml index 9ff45e5..bde4965 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,11 +6,13 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] +cosmwasm-schema = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" } cosmwasm-std = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" } cosmwasm-storage = { git = "https://github.com/enigmampc/SecretNetwork", tag = "v1.0.4-debug-print" } secret-toolkit = { git = "https://github.com/enigmampc/secret-toolkit", branch = "debug-print"} serde = { version = "1.0.103", default-features = false, features = ["derive"] } snafu = { version = "0.6.3" } +schemars = "0.7" remain = "0.2.2" ripemd160 = "0.9.1" secp256k1 = "0.20.3" diff --git a/src/permit.rs b/src/permit.rs index 363698a..7c60c5e 100644 --- a/src/permit.rs +++ b/src/permit.rs @@ -1,6 +1,7 @@ use crate::transaction::{PermitSignature, PubKeyValue, SignedTx, TxMsg}; use bech32::FromBase32; use cosmwasm_std::{to_binary, Binary, CanonicalAddr, StdError, StdResult}; +use schemars::JsonSchema; use secp256k1::Secp256k1; use secret_toolkit::crypto::sha_256; use serde::{Deserialize, Serialize}; @@ -10,7 +11,7 @@ use serde::{Deserialize, Serialize}; // Signature idea taken from https://github.com/scrtlabs/secret-toolkit/blob/token-permits/packages/permit/src/funcs.rs /// Where the information will be stored -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct Permit { pub params: T, diff --git a/src/transaction.rs b/src/transaction.rs index ea68eae..7f9ad0c 100644 --- a/src/transaction.rs +++ b/src/transaction.rs @@ -1,17 +1,18 @@ use crate::permit::Permit; use cosmwasm_std::{Api, Binary, CanonicalAddr, HumanAddr, StdResult, Uint128}; use ripemd160::{Digest, Ripemd160}; +use schemars::JsonSchema; use secret_toolkit::crypto::sha_256; use serde::{Deserialize, Serialize}; -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct PermitSignature { pub pub_key: PubKey, pub signature: Binary, } -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct PubKey { /// ignored, but must be "tendermint/PubKeySecp256k1" otherwise the verification will fail @@ -44,7 +45,7 @@ impl PubKeyValue { } #[remain::sorted] -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct TxMsg { pub r#type: String, @@ -61,7 +62,7 @@ impl TxMsg { } #[remain::sorted] -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct SignedTx { /// ignored @@ -92,7 +93,7 @@ impl SignedTx { } #[remain::sorted] -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct Fee { pub amount: Vec, @@ -109,7 +110,7 @@ impl Default for Fee { } #[remain::sorted] -#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)] +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub struct Coin { pub amount: Uint128,