diff --git a/cosmos-sdk-proto/src/type_names.rs b/cosmos-sdk-proto/src/type_names.rs index c00ed3b8..78de3c7b 100644 --- a/cosmos-sdk-proto/src/type_names.rs +++ b/cosmos-sdk-proto/src/type_names.rs @@ -280,6 +280,61 @@ impl_name!( "cosmos.staking.v1beta1", "MsgDelegateResponse" ); +impl_name!( + cosmos::staking::v1beta1::CommissionRates, + "cosmos.staking.v1beta1", + "CommissionRates" +); +impl_name!( + cosmos::staking::v1beta1::Commission, + "cosmos.staking.v1beta1", + "Commission" +); +impl_name!( + cosmos::staking::v1beta1::Description, + "cosmos.staking.v1beta1", + "Description" +); +impl_name!( + cosmos::staking::v1beta1::HistoricalInfo, + "cosmos.staking.v1beta1", + "HistoricalInfo" +); +impl_name!( + cosmos::staking::v1beta1::QueryHistoricalInfoRequest, + "cosmos.staking.v1beta1", + "QueryHistoricalInfoRequest" +); +impl_name!( + cosmos::staking::v1beta1::QueryHistoricalInfoResponse, + "cosmos.staking.v1beta1", + "QueryHistoricalInfoResponse" +); +impl_name!( + cosmos::staking::v1beta1::QueryValidatorRequest, + "cosmos.staking.v1beta1", + "QueryValidatorRequest" +); +impl_name!( + cosmos::staking::v1beta1::QueryValidatorResponse, + "cosmos.staking.v1beta1", + "QueryValidatorResponse" +); +impl_name!( + cosmos::staking::v1beta1::QueryValidatorsRequest, + "cosmos.staking.v1beta1", + "QueryValidatorsRequest" +); +impl_name!( + cosmos::staking::v1beta1::QueryValidatorsResponse, + "cosmos.staking.v1beta1", + "QueryValidatorsResponse" +); +impl_name!( + cosmos::staking::v1beta1::Validator, + "cosmos.staking.v1beta1", + "Validator" +); impl_name!( cosmos::base::abci::v1beta1::MsgData, diff --git a/cosmrs/src/staking.rs b/cosmrs/src/staking.rs index 00f91a3b..6abd61f6 100644 --- a/cosmrs/src/staking.rs +++ b/cosmrs/src/staking.rs @@ -2,11 +2,29 @@ //! //! +mod commission; +mod commission_rates; +mod description; +mod historical_info; mod msg_begin_redelegate; mod msg_delegate; mod msg_undelegate; +mod query_historical_info_request; +mod query_historical_info_response; +mod query_validator_request; +mod query_validator_response; +mod query_validators_request; +mod query_validators_response; +mod validator; pub use self::{ - msg_begin_redelegate::MsgBeginRedelegate, msg_delegate::MsgDelegate, - msg_undelegate::MsgUndelegate, + commission::Commission, commission_rates::CommissionRates, description::Description, + historical_info::HistoricalInfo, msg_begin_redelegate::MsgBeginRedelegate, + msg_delegate::MsgDelegate, msg_undelegate::MsgUndelegate, + query_historical_info_request::QueryHistoricalInfoRequest, + query_historical_info_response::QueryHistoricalInfoResponse, + query_validator_request::QueryValidatorRequest, + query_validator_response::QueryValidatorResponse, + query_validators_request::QueryValidatorsRequest, + query_validators_response::QueryValidatorsResponse, validator::Validator, }; diff --git a/cosmrs/src/staking/commission.rs b/cosmrs/src/staking/commission.rs new file mode 100644 index 00000000..67471f2c --- /dev/null +++ b/cosmrs/src/staking/commission.rs @@ -0,0 +1,49 @@ +use crate::staking::CommissionRates; +use crate::{proto, ErrorReport, Result}; +use cosmos_sdk_proto::Timestamp; +use tendermint::Time; + +/// Commission defines commission parameters for a given validator. +#[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] +pub struct Commission { + /// commission_rates defines the initial commission rates to be used for creating a validator. + pub commission_rates: Option, + + /// update_time is the last time the commission rate was changed. + pub update_time: Option