Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cron improvements #165

Merged
merged 2 commits into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 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},
proto_types::neutron::cron::ExecutionStage,
sudo::msg::RequestPacketTimeoutHeight,
NeutronResult,
};
Expand Down Expand Up @@ -228,6 +229,8 @@ pub enum NeutronMsg {
period: u64,
/// list of cosmwasm messages to be executed
msgs: Vec<MsgExecuteContract>,
/// execution stage where schedule will be executed
execution_stage: String,
},

/// RemoveSchedule removes the schedule with a given `name`.
Expand Down Expand Up @@ -511,8 +514,19 @@ 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.
pub fn submit_add_schedule(name: String, period: u64, msgs: Vec<MsgExecuteContract>) -> Self {
NeutronMsg::AddSchedule { name, period, msgs }
/// * **execution_stage** is the stage where schedule will be executed.
pub fn submit_add_schedule(
name: String,
period: u64,
msgs: Vec<MsgExecuteContract>,
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:
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 @@
ba1b1d6dc91370d81e7125962e02aee01274eac
1bf83371924e7f3f5a756c8a9ea35e2d607a984e
55 changes: 44 additions & 11 deletions packages/neutron-sdk/src/proto_types/neutron/contractmanager/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,10 +132,34 @@ pub struct QueryParamsResponse {
)]
#[proto_message(type_url = "/neutron.contractmanager.QueryFailuresRequest")]
#[proto_query(
path = "/neutron.contractmanager.Query/AddressFailure",
path = "/neutron.contractmanager.Query/AddressFailures",
response_type = QueryFailuresResponse
)]
pub struct QueryFailuresRequest {
/// address of the contract which Sudo call failed.
#[prost(string, tag = "1")]
pub address: ::prost::alloc::string::String,
#[prost(message, optional, tag = "3")]
pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
}
/// QueryFailureRequest is request type for the Query/Failures RPC method.
#[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.contractmanager.QueryFailureRequest")]
#[proto_query(
path = "/neutron.contractmanager.Query/AddressFailure",
response_type = QueryFailureResponse
)]
pub struct QueryFailureRequest {
/// address of the contract which Sudo call failed.
#[prost(string, tag = "1")]
pub address: ::prost::alloc::string::String,
Expand All @@ -147,8 +171,23 @@ pub struct QueryFailuresRequest {
deserialize_with = "crate::serde::as_str::deserialize"
)]
pub failure_id: u64,
#[prost(message, optional, tag = "3")]
pub pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
}
/// QueryFailureResponse is response type for the Query/Failure RPC method.
#[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.contractmanager.QueryFailureResponse")]
pub struct QueryFailureResponse {
#[prost(message, optional, tag = "1")]
pub failure: ::core::option::Option<Failure>,
}
/// QueryFailuresResponse is response type for the Query/Failures RPC method.
#[allow(clippy::derive_partial_eq_without_eq)]
Expand Down Expand Up @@ -226,37 +265,31 @@ impl<'a, Q: cosmwasm_std::CustomQuery> ContractmanagerQuerier<'a, Q> {
&self,
address: ::prost::alloc::string::String,
failure_id: u64,
pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
) -> Result<QueryFailuresResponse, cosmwasm_std::StdError> {
QueryFailuresRequest {
) -> Result<QueryFailureResponse, cosmwasm_std::StdError> {
QueryFailureRequest {
address,
failure_id,
pagination,
}
.query(self.querier)
}
pub fn address_failures(
&self,
address: ::prost::alloc::string::String,
failure_id: u64,
pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
) -> Result<QueryFailuresResponse, cosmwasm_std::StdError> {
QueryFailuresRequest {
address,
failure_id,
pagination,
}
.query(self.querier)
}
pub fn failures(
&self,
address: ::prost::alloc::string::String,
failure_id: u64,
pagination: ::core::option::Option<super::super::cosmos::base::query::v1beta1::PageRequest>,
) -> Result<QueryFailuresResponse, cosmwasm_std::StdError> {
QueryFailuresRequest {
address,
failure_id,
pagination,
}
.query(self.querier)
Expand Down
Loading
Loading