Skip to content

Commit

Permalink
feat: use neutron with ordering in MsgRegisterICA
Browse files Browse the repository at this point in the history
  • Loading branch information
NeverHappened committed Aug 7, 2024
1 parent 4a43e06 commit f2faefb
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 7 deletions.
16 changes: 15 additions & 1 deletion packages/neutron-sdk/src/bindings/msg.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,14 @@ pub struct IbcFee {
pub timeout_fee: Vec<Coin>,
}

#[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.
Expand All @@ -42,6 +50,10 @@ pub enum NeutronMsg {

/// **register_fee** is a fees required to be payed to register interchain account
register_fee: Option<Vec<Coin>>,

/// **ordering** is an order of channel. Can be ordered or unordered.
/// Set to ordered if not specified.
ordering: Option<ChannelOrdering>
},

/// SubmitTx starts the process of executing any Cosmos-SDK *msgs* on remote chain.
Expand Down Expand Up @@ -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<Vec<KVKey>>,

/// **new_update_period** is a new update period of the query.
Expand Down Expand Up @@ -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<Vec<Coin>>,
ordering: Option<Ordering>
) -> Self {
NeutronMsg::RegisterInterchainAccount {
connection_id,
Expand Down
2 changes: 1 addition & 1 deletion packages/neutron-sdk/src/proto_types/NEUTRON_COMMIT
Original file line number Diff line number Diff line change
@@ -1 +1 @@
v4.1.0
ba1b1d6dc91370d81e7125962e02aee01274eac
8 changes: 4 additions & 4 deletions packages/neutron-sdk/src/proto_types/ibc/core/channel/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Self> {
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,
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<super::super::super::cosmos::base::v1beta1::Coin>,
#[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.
Expand Down
2 changes: 1 addition & 1 deletion proto-build/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down

0 comments on commit f2faefb

Please sign in to comment.