Skip to content

Commit

Permalink
use neutron-std Order type for channels; fix some schema generation
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Oct 15, 2024
1 parent 31b5fcb commit c31f4db
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 41 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

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

3 changes: 1 addition & 2 deletions contracts/marketmap/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use marketmap::contract::InstantiateMsg;
use neutron_sdk::bindings::marketmap::query::MarketMapQuery;

fn main() {
let mut out_dir = current_dir().unwrap();
Expand All @@ -26,5 +25,5 @@ fn main() {
remove_schemas(&out_dir).unwrap();

export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(MarketMapQuery), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
}
11 changes: 1 addition & 10 deletions contracts/marketmap/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,9 @@
use crate::query::QueryMsg;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use cosmwasm_std::{
entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
};
use cw2::set_contract_version;
use neutron_std::types::slinky::marketmap::v1::MarketmapQuerier;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {}

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down
2 changes: 1 addition & 1 deletion contracts/marketmap/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod contract;
mod query;
mod msg;
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@ use neutron_std::types::slinky::types::v1::CurrencyPair;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Expand Down
7 changes: 2 additions & 5 deletions contracts/neutron_interchain_queries/src/testing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,6 @@ use cosmwasm_std::{
from_json, to_json_binary, Addr, Binary, Coin, Decimal, Env, MessageInfo, OwnedDeps, StdError,
Uint128,
};
use neutron_sdk::bindings::query::{
NeutronQuery, QueryRegisteredQueryResponse, QueryRegisteredQueryResultResponse,
};
use neutron_sdk::bindings::types::{decode_hex, Height};
use neutron_sdk::interchain_queries::helpers::decode_and_convert;
use neutron_sdk::interchain_queries::types::{
QueryType, TransactionFilterItem, TransactionFilterOp, TransactionFilterValue,
Expand All @@ -55,12 +51,13 @@ use neutron_sdk::interchain_queries::v047::types::{
ValidatorSigningInfo, WeightedVoteOption, DECIMAL_PLACES, RECIPIENT_FIELD,
};
use neutron_sdk::NeutronError;
use neutron_std::types::neutron::interchainqueries::KvKey;
use prost::Message as ProstMessage;
use schemars::_serde_json::to_string;
use std::ops::Mul;

enum QueryParam {
Keys(Vec<KVKey>),
Keys(Vec<KvKey>),
TransactionsFilter(String),
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use neutron_interchain_txs::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg};
use neutron_sdk::bindings::query::QueryInterchainAccountAddressResponse;
use neutron_sdk::sudo::msg::SudoMsg;
use neutron_std::types::neutron::interchaintxs::v1::QueryInterchainAccountAddressResponse;
use std::env::current_dir;
use std::fs::create_dir_all;

Expand Down
4 changes: 2 additions & 2 deletions contracts/neutron_interchain_txs/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ use crate::storage::{
INTEGRATION_TESTS_SUDO_SUBMSG_FAILURE_MOCK, INTERCHAIN_ACCOUNTS, REGISTER_FEE,
REGISTER_ICA_REPLY_ID, SUDO_FAILING_SUBMSG_REPLY_ID, SUDO_PAYLOAD_REPLY_ID, TEST_COUNTER_ITEM,
};
use neutron_sdk::bindings::msg::ChannelOrdering;
use neutron_sdk::interchain_txs::helpers::{
decode_message_response, get_port_id, register_interchain_account, submit_tx,
};
use neutron_sdk::interchain_txs::v047::helpers::decode_acknowledgement_response;
use neutron_sdk::sudo::msg::{RequestPacket, SudoMsg};
use neutron_sdk::NeutronResult;
use neutron_std::shim::Any;
use neutron_std::types::ibc::core::channel::v1::Order;
use neutron_std::types::neutron::contractmanager::MsgResubmitFailure;
use neutron_std::types::neutron::feerefunder::Fee;
use neutron_std::types::neutron::interchaintxs::v1::{
Expand Down Expand Up @@ -313,7 +313,7 @@ fn execute_register_ica(
env: Env,
connection_id: String,
interchain_account_id: String,
ordering: Option<ChannelOrdering>,
ordering: Option<Order>,
) -> StdResult<Response> {
let register_fee = REGISTER_FEE.load(deps.storage)?;
let register = register_interchain_account(
Expand Down
4 changes: 2 additions & 2 deletions contracts/neutron_interchain_txs/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::storage::{AcknowledgementResult, IntegrationTestsSudoFailureMock};
use cosmwasm_std::Uint128;
use neutron_sdk::bindings::msg::ChannelOrdering;
use neutron_std::types::ibc::core::channel::v1::Order;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -39,7 +39,7 @@ pub enum ExecuteMsg {
Register {
connection_id: String,
interchain_account_id: String,
ordering: Option<ChannelOrdering>,
ordering: Option<Order>,
},
SetFees {
denom: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
// limitations under the License.

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use neutron_sdk::bindings::query::QueryInterchainAccountAddressResponse;
use neutron_sdk::sudo::msg::SudoMsg;
use neutron_std::types::neutron::interchaintxs::v1::QueryInterchainAccountAddressResponse;
use neutron_validators_test::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use std::env::current_dir;
use std::fs::create_dir_all;
Expand Down
4 changes: 2 additions & 2 deletions contracts/neutron_validator_test/src/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ use cosmwasm_std::{
Response, StdError, StdResult, SubMsg, Uint128,
};
use cw2::set_contract_version;
use neutron_sdk::bindings::msg::ChannelOrdering;
use neutron_sdk::interchain_queries::helpers::remove_interchain_query as helpers_remove_interchain_query;
use neutron_sdk::interchain_queries::queries::get_registered_query;
use neutron_sdk::interchain_queries::types::{
Expand All @@ -53,6 +52,7 @@ use neutron_sdk::sudo::msg::{RequestPacket, SudoMsg};
use neutron_sdk::{NeutronError, NeutronResult};
use neutron_std::shim::Any;
use neutron_std::types::cosmos::base::v1beta1::Coin as CosmosCoin;
use neutron_std::types::ibc::core::channel::v1::Order;
use neutron_std::types::ibc::core::client::v1::Height;
use neutron_std::types::neutron::feerefunder::Fee;
use neutron_std::types::neutron::interchainqueries::RegisteredQuery;
Expand Down Expand Up @@ -290,7 +290,7 @@ fn execute_register_ica(
connection_id,
interchain_account_id.clone(),
vec![],
Some(ChannelOrdering::OrderOrdered),
Some(Order::Ordered),
);
let key = get_port_id(env.contract.address.as_str(), &interchain_account_id);
INTERCHAIN_ACCOUNTS.save(deps.storage, key, &None)?;
Expand Down
4 changes: 2 additions & 2 deletions contracts/oracle/examples/schema.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ use std::env::current_dir;
use std::fs::create_dir_all;

use cosmwasm_schema::{export_schema, remove_schemas, schema_for};
use neutron_sdk::bindings::oracle::query::OracleQuery;
use oracle::contract::InstantiateMsg;
use oracle::msg::QueryMsg;

fn main() {
let mut out_dir = current_dir().unwrap();
Expand All @@ -26,5 +26,5 @@ fn main() {
remove_schemas(&out_dir).unwrap();

export_schema(&schema_for!(InstantiateMsg), &out_dir);
export_schema(&schema_for!(OracleQuery), &out_dir);
export_schema(&schema_for!(QueryMsg), &out_dir);
}
11 changes: 1 addition & 10 deletions contracts/oracle/src/contract.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,10 @@
use crate::msg::QueryMsg;
use crate::msg::{ExecuteMsg, InstantiateMsg, QueryMsg};
use cosmwasm_std::{
entry_point, to_json_binary, Binary, Deps, DepsMut, Env, MessageInfo, Response, StdResult,
};
use cw2::set_contract_version;
use neutron_std::types::slinky::oracle::v1::OracleQuerier;
use neutron_std::types::slinky::types::v1::CurrencyPair;
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {}

const CONTRACT_NAME: &str = concat!("crates.io:neutron-contracts__", env!("CARGO_PKG_NAME"));
const CONTRACT_VERSION: &str = env!("CARGO_PKG_VERSION");
Expand Down
2 changes: 1 addition & 1 deletion contracts/oracle/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pub mod contract;
mod msg;
pub mod msg;
7 changes: 7 additions & 0 deletions contracts/oracle/src/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};

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

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
#[serde(rename_all = "snake_case")]
pub enum ExecuteMsg {}

#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)]
#[serde(rename_all = "snake_case")]
pub enum QueryMsg {
Expand Down

0 comments on commit c31f4db

Please sign in to comment.