diff --git a/contracts/neutron_interchain_txs/src/contract.rs b/contracts/neutron_interchain_txs/src/contract.rs index 14ac5056..a23cb4b5 100644 --- a/contracts/neutron_interchain_txs/src/contract.rs +++ b/contracts/neutron_interchain_txs/src/contract.rs @@ -12,7 +12,12 @@ use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::msg::{ExecuteMsg, InstantiateMsg, MigrateMsg, QueryMsg}; -use neutron_sdk::bindings::msg::IbcFee; +use crate::storage::{ + add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, + save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, + ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, +}; +use neutron_sdk::bindings::msg::{ChannelOrdering, IbcFee}; use neutron_sdk::proto_types::neutron::interchaintxs::v1::MsgSubmitTxResponse; use neutron_sdk::{ bindings::{ @@ -27,12 +32,6 @@ use neutron_sdk::{ NeutronError, NeutronResult, }; -use crate::storage::{ - add_error_to_queue, read_errors_from_queue, read_reply_payload, read_sudo_payload, - save_reply_payload, save_sudo_payload, AcknowledgementResult, SudoPayload, - ACKNOWLEDGEMENT_RESULTS, INTERCHAIN_ACCOUNTS, SUDO_PAYLOAD_REPLY_ID, -}; - // Default timeout for SubmitTX is two weeks const DEFAULT_TIMEOUT_SECONDS: u64 = 60 * 60 * 24 * 7 * 2; const FEE_DENOM: &str = "untrn"; @@ -77,12 +76,14 @@ pub fn execute( connection_id, interchain_account_id, register_fee, + ordering, } => execute_register_ica( deps, env, connection_id, interchain_account_id, register_fee, + ordering, ), ExecuteMsg::Delegate { validator, @@ -198,11 +199,13 @@ fn execute_register_ica( connection_id: String, interchain_account_id: String, register_fee: Vec, + ordering: Option, ) -> NeutronResult> { let register = NeutronMsg::register_interchain_account( connection_id, interchain_account_id.clone(), Some(register_fee), + ordering, ); let key = get_port_id(env.contract.address.as_str(), &interchain_account_id); // we are saving empty data here because we handle response of registering ICA in sudo_open_ack method diff --git a/contracts/neutron_interchain_txs/src/msg.rs b/contracts/neutron_interchain_txs/src/msg.rs index e75bffe7..d4f44823 100644 --- a/contracts/neutron_interchain_txs/src/msg.rs +++ b/contracts/neutron_interchain_txs/src/msg.rs @@ -1,4 +1,5 @@ use cosmwasm_std::Coin; +use neutron_sdk::bindings::msg::ChannelOrdering; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; @@ -36,6 +37,7 @@ pub enum ExecuteMsg { connection_id: String, interchain_account_id: String, register_fee: Vec, + ordering: Option, }, Delegate { interchain_account_id: String, diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index df2c1ad4..f5255eec 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -1,7 +1,6 @@ use crate::{ bindings::types::{KVKey, ProtobufAny}, interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem}, - proto_types::neutron::cron::ExecutionStage, sudo::msg::RequestPacketTimeoutHeight, NeutronResult, }; @@ -28,6 +27,13 @@ pub struct IbcFee { pub timeout_fee: Vec, } +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ChannelOrdering { + OrderOrdered, + OrderUnordered, +} + #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] #[serde(rename_all = "snake_case")] /// A number of Custom messages that can call into the Neutron bindings. @@ -43,6 +49,10 @@ pub enum NeutronMsg { /// **register_fee** is a fees required to be payed to register interchain account register_fee: Option>, + + /// **ordering** is an order of channel. Can be ordered or unordered. + /// Set to ordered if not specified. + ordering: Option, }, /// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain. @@ -89,7 +99,7 @@ pub enum NeutronMsg { /// **query_id** is the ID of the query we want to update. query_id: u64, - /// **new_keys** is the new query keys to retrive. + /// **new_keys** is the new query keys to retrieve. new_keys: Option>, /// **new_update_period** is a new update period of the query. @@ -206,26 +216,6 @@ pub enum NeutronMsg { uri_hash: String, }, - /// AddSchedule adds new schedule with a given `name`. - /// Until schedule is removed it will execute all `msgs` every `period` blocks. - /// First execution is at least on `current_block + period` block. - /// [Permissioned - DAO Only] - AddSchedule { - /// Name of a new schedule. - /// Needed to be able to `RemoveSchedule` and to log information about it - name: String, - /// period in blocks with which `msgs` will be executed - period: u64, - /// list of cosmwasm messages to be executed - msgs: Vec, - /// execution stage where schedule will be executed - execution_stage: String, - }, - - /// RemoveSchedule removes the schedule with a given `name`. - /// [Permissioned - DAO or Security DAO only] - RemoveSchedule { name: String }, - /// Contractmanager message /// Resubmits failed acknowledgement. /// Acknowledgement failure is created when contract returns error or acknowledgement is out of gas. @@ -240,15 +230,18 @@ impl NeutronMsg { /// Basic helper to define a register interchain account message: /// * **connection_id** is an IBC connection identifier between Neutron and remote chain; /// * **interchain_account_id** is an identifier of your new interchain account. Can be any string. + /// * **ordering** is an ordering of ICA channel. Set to ORDERED if not specified pub fn register_interchain_account( connection_id: String, interchain_account_id: String, register_fee: Option>, + ordering: Option, ) -> Self { NeutronMsg::RegisterInterchainAccount { connection_id, interchain_account_id, register_fee, + ordering, } } @@ -496,31 +489,6 @@ impl NeutronMsg { } } - /// Basic helper to define add schedule passed to Cron module: - /// * **name** is a name of the schedule; - /// * **period** is a period of schedule execution in blocks; - /// * **msgs** is the messages that will be executed. - /// * **execution_stage** is the stage where schedule will be executed. - pub fn submit_add_schedule( - name: String, - period: u64, - msgs: Vec, - execution_stage: ExecutionStage, - ) -> Self { - NeutronMsg::AddSchedule { - name, - period, - msgs, - execution_stage: execution_stage.as_str_name().to_string(), - } - } - - /// Basic helper to define remove schedule passed to Cron module: - /// * **name** is a name of the schedule to be removed. - pub fn submit_remove_schedule(name: String) -> Self { - NeutronMsg::RemoveSchedule { name } - } - /// Basic helper to define resubmit failure passed to Contractmanager module: /// * **failure_id** is an id of the failure to be resubmitted. pub fn submit_resubmit_failure(failure_id: u64) -> Self { diff --git a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs b/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs index f34f90ca..63d5b3b3 100644 --- a/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs +++ b/packages/neutron-sdk/src/proto_types/neutron/interchaintxs/v1.rs @@ -151,6 +151,15 @@ pub struct MsgRegisterInterchainAccount { pub interchain_account_id: ::prost::alloc::string::String, #[prost(message, repeated, tag = "4")] pub register_fee: ::prost::alloc::vec::Vec, + #[prost( + enumeration = "super::super::super::ibc::core::channel::v1::Order", + tag = "5" + )] + #[serde( + serialize_with = "crate::serde::as_str::serialize", + deserialize_with = "crate::serde::as_str::deserialize" + )] + pub ordering: i32, } /// MsgRegisterInterchainAccountResponse is the response type for /// MsgRegisterInterchainAccount.