Skip to content

Commit

Permalink
regen proto
Browse files Browse the repository at this point in the history
  • Loading branch information
joldie777 committed Aug 21, 2024
1 parent 45007a5 commit c965f9d
Show file tree
Hide file tree
Showing 5 changed files with 184 additions and 22 deletions.
11 changes: 6 additions & 5 deletions packages/neutron-sdk/src/bindings/msg.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::{
bindings::types::{KVKey, ProtobufAny},
interchain_queries::types::{QueryPayload, QueryType, TransactionFilterItem, MAX_TX_FILTERS},
proto_types::neutron::cron::ExecutionStage,
sudo::msg::RequestPacketTimeoutHeight,
NeutronError, NeutronResult,
};
Expand Down Expand Up @@ -217,8 +218,8 @@ pub enum NeutronMsg {
period: u64,
/// list of cosmwasm messages to be executed
msgs: Vec<MsgExecuteContract>,
/// blocker where schedule should be executed
blocker: u64,
/// execution stage where schedule will be executed
execution_stage: String,
},

/// RemoveSchedule removes the schedule with a given `name`.
Expand Down Expand Up @@ -511,18 +512,18 @@ impl NeutronMsg {
/// * **name** is a name of the schedule;
/// * **period** is a period of schedule execution in blocks;
/// * **msgs** is the messages that will be executed.
/// * **blocker** is a blocker where schedule will be executed.
/// * **execution_stage** is a stage where schedule will be executed.
pub fn submit_add_schedule(
name: String,
period: u64,
msgs: Vec<MsgExecuteContract>,
blocker: u64,
execution_stage: ExecutionStage,
) -> Self {
NeutronMsg::AddSchedule {
name,
period,
msgs,
blocker,
execution_stage: execution_stage.as_str_name().to_string(),
}
}

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 @@
ef1d7992fbdd6a927a2c7c4b4eebe2dfe2cdd27a
fd5e5e5bd6d061f19a566e71aaaeaabe59406069
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod v1;
use neutron_std_derive::CosmwasmExt;
/// Params defines the parameters for the module.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -57,13 +58,13 @@ pub struct Schedule {
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub last_execute_height: u64,
/// Blocker where the messages will be executed
#[prost(enumeration = "BlockerType", tag = "5")]
/// Execution stage when messages will be executed
#[prost(enumeration = "ExecutionStage", tag = "5")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub blocker: i32,
pub execution_stage: i32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Expand Down Expand Up @@ -106,33 +107,33 @@ pub struct ScheduleCount {
)]
pub count: i32,
}
/// BlockerType defines when messages will be executed in the block
/// ExecutionStage defines when messages will be executed in the block
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ::prost::Enumeration)]
#[repr(i32)]
#[derive(::serde::Serialize, ::serde::Deserialize, ::schemars::JsonSchema)]
pub enum BlockerType {
Begin = 0,
End = 1,
Both = 2,
pub enum ExecutionStage {
BeginBlocker = 0,
EndBlocker = 1,
BothBlockers = 2,
}
impl BlockerType {
impl ExecutionStage {
/// String value of the enum field names used in the ProtoBuf definition.
///
/// The values are not transformed in any way and thus are considered stable
/// (if the ProtoBuf definition does not change) and safe for programmatic use.
pub fn as_str_name(&self) -> &'static str {
match self {
BlockerType::Begin => "BEGIN",
BlockerType::End => "END",
BlockerType::Both => "BOTH",
ExecutionStage::BeginBlocker => "BEGIN_BLOCKER",
ExecutionStage::EndBlocker => "END_BLOCKER",
ExecutionStage::BothBlockers => "BOTH_BLOCKERS",
}
}
/// Creates an enum from field names used in the ProtoBuf definition.
pub fn from_str_name(value: &str) -> ::core::option::Option<Self> {
match value {
"BEGIN" => Some(Self::Begin),
"END" => Some(Self::End),
"BOTH" => Some(Self::Both),
"BEGIN_BLOCKER" => Some(Self::BeginBlocker),
"END_BLOCKER" => Some(Self::EndBlocker),
"BOTH_BLOCKERS" => Some(Self::BothBlockers),
_ => None,
}
}
Expand Down Expand Up @@ -263,6 +264,90 @@ pub struct QuerySchedulesResponse {
pub pagination:
::core::option::Option<super::super::cosmos::base::query::v1beta1::PageResponse>,
}
/// MsgAddSchedule is the MsgAddSchedule request type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.MsgAddSchedule")]
pub struct MsgAddSchedule {
/// Authority is the address of the governance account.
#[prost(string, tag = "1")]
pub authority: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
#[prost(uint64, tag = "3")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub period: u64,
#[prost(message, repeated, tag = "4")]
pub msgs: ::prost::alloc::vec::Vec<MsgExecuteContract>,
#[prost(enumeration = "ExecutionStage", tag = "5")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub execution_stage: i32,
}
/// MsgAddScheduleResponse defines the response structure for executing a
/// MsgAddSchedule message.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.MsgAddScheduleResponse")]
pub struct MsgAddScheduleResponse {}
/// MsgRemoveSchedule is the MsgRemoveSchedule request type.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.MsgRemoveSchedule")]
pub struct MsgRemoveSchedule {
/// Authority is the address of the governance account.
#[prost(string, tag = "1")]
pub authority: ::prost::alloc::string::String,
#[prost(string, tag = "2")]
pub name: ::prost::alloc::string::String,
}
/// MsgRemoveScheduleResponse defines the response structure for executing a
/// MsgRemoveSchedule message.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.MsgRemoveScheduleResponse")]
pub struct MsgRemoveScheduleResponse {}
/// MsgUpdateParams is the MsgUpdateParams request type.
///
/// Since: 0.47
Expand Down
76 changes: 76 additions & 0 deletions packages/neutron-sdk/src/proto_types/neutron/cron/v1.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
use neutron_std_derive::CosmwasmExt;
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.v1.Schedule")]
pub struct Schedule {
/// Name of schedule
#[prost(string, tag = "1")]
pub name: ::prost::alloc::string::String,
/// Period in blocks
#[prost(uint64, tag = "2")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub period: u64,
/// Msgs that will be executed every period amount of time
#[prost(message, repeated, tag = "3")]
pub msgs: ::prost::alloc::vec::Vec<MsgExecuteContract>,
/// Last execution's block height
#[prost(uint64, tag = "4")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub last_execute_height: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.v1.MsgExecuteContract")]
pub struct MsgExecuteContract {
/// Contract is the address of the smart contract
#[prost(string, tag = "1")]
pub contract: ::prost::alloc::string::String,
/// Msg is json encoded message to be passed to the contract
#[prost(string, tag = "2")]
pub msg: ::prost::alloc::string::String,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(
Clone,
PartialEq,
Eq,
::prost::Message,
::serde::Serialize,
::serde::Deserialize,
::schemars::JsonSchema,
CosmwasmExt,
)]
#[proto_message(type_url = "/neutron.cron.v1.ScheduleCount")]
pub struct ScheduleCount {
/// Count is the number of current schedules
#[prost(int32, tag = "1")]
#[serde(
serialize_with = "crate::serde::as_str::serialize",
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub count: i32,
}
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 = "ef1d7992fbdd6a927a2c7c4b4eebe2dfe2cdd27a";
const NEUTRON_REV: &str = "fd5e5e5bd6d061f19a566e71aaaeaabe59406069";

/// 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 c965f9d

Please sign in to comment.