From f2faefb98aaebe853c7983bd652f9255c0b842c9 Mon Sep 17 00:00:00 2001 From: nhpd Date: Wed, 7 Aug 2024 14:16:19 +0400 Subject: [PATCH] feat: use neutron with ordering in MsgRegisterICA --- packages/neutron-sdk/src/bindings/msg.rs | 16 +++++++++++++++- .../neutron-sdk/src/proto_types/NEUTRON_COMMIT | 2 +- .../src/proto_types/ibc/core/channel/v1.rs | 8 ++++---- .../src/proto_types/neutron/interchaintxs/v1.rs | 9 +++++++++ proto-build/src/main.rs | 2 +- 5 files changed, 30 insertions(+), 7 deletions(-) diff --git a/packages/neutron-sdk/src/bindings/msg.rs b/packages/neutron-sdk/src/bindings/msg.rs index 5b8daf9c..3f0602a9 100644 --- a/packages/neutron-sdk/src/bindings/msg.rs +++ b/packages/neutron-sdk/src/bindings/msg.rs @@ -27,6 +27,14 @@ pub struct IbcFee { pub timeout_fee: Vec, } +#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq, JsonSchema)] +#[serde(rename_all = "SCREAMING_SNAKE_CASE")] +pub enum ChannelOrdering { + None, + 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. @@ -42,6 +50,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. @@ -88,7 +100,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. @@ -237,10 +249,12 @@ 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, diff --git a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT index 5469c48c..007a1cae 100644 --- a/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT +++ b/packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT @@ -1 +1 @@ -v4.1.0 \ No newline at end of file +ba1b1d6dc91370d81e7125962e02aee01274eac \ No newline at end of file diff --git a/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs b/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs index 5b5f0c9b..3802ad84 100644 --- a/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs +++ b/packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs @@ -415,16 +415,16 @@ impl Order { pub fn as_str_name(&self) -> &'static str { match self { Order::NoneUnspecified => "ORDER_NONE_UNSPECIFIED", - Order::Unordered => "ORDER_UNORDERED", - Order::Ordered => "ORDER_ORDERED", + Order::Unordered => "OrderUnordered", + Order::Ordered => "OrderOrdered", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option { match value { "ORDER_NONE_UNSPECIFIED" => Some(Self::NoneUnspecified), - "ORDER_UNORDERED" => Some(Self::Unordered), - "ORDER_ORDERED" => Some(Self::Ordered), + "OrderUnordered" => Some(Self::Unordered), + "OrderOrdered" => Some(Self::Ordered), _ => None, } } 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. diff --git a/proto-build/src/main.rs b/proto-build/src/main.rs index 52f00d8c..aef0f71c 100644 --- a/proto-build/src/main.rs +++ b/proto-build/src/main.rs @@ -23,7 +23,7 @@ const SLINKY_REPO: &str = "https://github.com/skip-mev/slinky.git"; const COSMOS_SDK_REV: &str = "v0.50.8-neutron"; /// The Neutron commit or tag to be cloned and used to build the proto files -const NEUTRON_REV: &str = "v4.1.0"; +const NEUTRON_REV: &str = "ba1b1d6dc91370d81e7125962e02aee01274eac"; /// The wasmd commit or tag to be cloned and used to build the proto files const WASMD_REV: &str = "v0.51.0";