├── .gitignore
├── rust-toolchain
├── cosmos-sdk-proto
├── src
│ ├── prost
│ │ ├── wasmd
│ │ │ ├── WASMD_COMMIT
│ │ │ ├── amino.rs
│ │ │ ├── cosmos.msg.v1.rs
│ │ │ ├── cosmos.query.v1.rs
│ │ │ └── cosmos.base.v1beta1.rs
│ │ └── cosmos-sdk
│ │ │ ├── COSMOS_SDK_COMMIT
│ │ │ ├── amino.rs
│ │ │ ├── cosmos.msg.v1.rs
│ │ │ ├── cosmos.query.v1.rs
│ │ │ ├── cosmos.msg.textual.v1.rs
│ │ │ ├── cosmos.nft.module.v1.rs
│ │ │ ├── cosmos.authz.module.v1.rs
│ │ │ ├── cosmos.params.module.v1.rs
│ │ │ ├── cosmos.genutil.module.v1.rs
│ │ │ ├── cosmos.vesting.module.v1.rs
│ │ │ ├── cosmos.evidence.module.v1.rs
│ │ │ ├── cosmos.feegrant.module.v1.rs
│ │ │ ├── cosmos.orm.module.v1alpha1.rs
│ │ │ ├── cosmos.circuit.module.v1.rs
│ │ │ ├── cosmos.upgrade.module.v1.rs
│ │ │ ├── cosmos.genutil.v1beta1.rs
│ │ │ ├── cosmos.slashing.module.v1.rs
│ │ │ ├── cosmos.consensus.module.v1.rs
│ │ │ ├── cosmos.mint.module.v1.rs
│ │ │ ├── cosmos.distribution.module.v1.rs
│ │ │ ├── cosmos.crypto.multisig.rs
│ │ │ ├── cosmos.crisis.module.v1.rs
│ │ │ ├── cosmos.gov.module.v1.rs
│ │ │ ├── cosmos.tx.config.v1.rs
│ │ │ ├── cosmos.group.module.v1.rs
│ │ │ ├── cosmos.crypto.hd.v1.rs
│ │ │ ├── cosmos.reflection.v1.rs
│ │ │ ├── cosmos.crypto.secp256r1.rs
│ │ │ ├── cosmos.store.internal.kv.v1beta1.rs
│ │ │ ├── cosmos.crypto.secp256k1.rs
│ │ │ ├── cosmos.staking.module.v1.rs
│ │ │ ├── cosmos.bank.module.v1.rs
│ │ │ ├── cosmos.crypto.ed25519.rs
│ │ │ ├── cosmos.crypto.multisig.v1beta1.rs
│ │ │ ├── cosmos.auth.module.v1.rs
│ │ │ ├── cosmos.nft.module.v1.serde.rs
│ │ │ ├── cosmos.authz.module.v1.serde.rs
│ │ │ ├── cosmos.base.v1beta1.rs
│ │ │ ├── cosmos.params.module.v1.serde.rs
│ │ │ ├── cosmos.genutil.module.v1.serde.rs
│ │ │ ├── cosmos.vesting.module.v1.serde.rs
│ │ │ ├── cosmos.base.reflection.v1beta1.rs
│ │ │ ├── cosmos.evidence.module.v1.serde.rs
│ │ │ ├── cosmos.feegrant.module.v1.serde.rs
│ │ │ └── cosmos.orm.module.v1alpha1.serde.rs
│ └── traits.rs
├── Cargo.toml
└── README.md
├── .images
└── cosmos.png
├── cosmrs
├── src
│ ├── base
│ │ ├── query.rs
│ │ ├── denom.rs
│ │ └── coin.rs
│ ├── crypto
│ │ ├── secp256k1.rs
│ │ └── compact_bit_array.rs
│ ├── auth.rs
│ ├── bank.rs
│ ├── crypto.rs
│ ├── abci.rs
│ ├── base.rs
│ ├── feegrant.rs
│ ├── vesting.rs
│ ├── distribution.rs
│ ├── slashing
│ │ ├── query_params_request.rs
│ │ ├── missed_block.rs
│ │ ├── query_signing_infos_request.rs
│ │ ├── query_params_response.rs
│ │ ├── query_signing_info_request.rs
│ │ ├── query_signing_info_response.rs
│ │ ├── signing_info.rs
│ │ ├── validator_missed_blocks.rs
│ │ ├── query_signing_infos_response.rs
│ │ ├── msg_unjail.rs
│ │ ├── genesis_state.rs
│ │ └── params.rs
│ ├── staking
│ │ ├── query_historical_info_request.rs
│ │ ├── query_validator_request.rs
│ │ ├── query_validator_response.rs
│ │ ├── query_historical_info_response.rs
│ │ ├── query_validators_request.rs
│ │ ├── commission_rates.rs
│ │ ├── historical_info.rs
│ │ ├── description.rs
│ │ ├── query_validators_response.rs
│ │ ├── commission.rs
│ │ ├── msg_delegate.rs
│ │ ├── msg_undelegate.rs
│ │ └── msg_begin_redelegate.rs
│ ├── tx
│ │ ├── msg.rs
│ │ ├── raw.rs
│ │ ├── builder.rs
│ │ └── auth_info.rs
│ ├── abci
│ │ └── gas_info.rs
│ ├── slashing.rs
│ ├── staking.rs
│ ├── cosmwasm
│ │ ├── query_code_response.rs
│ │ ├── absolute_tx_position.rs
│ │ ├── contract_code_history_entry.rs
│ │ ├── code_info_response.rs
│ │ ├── access_config.rs
│ │ ├── contract_info.rs
│ │ ├── msg_clear_admin.rs
│ │ ├── msg_migrate_contract.rs
│ │ ├── msg_update_admin.rs
│ │ ├── msg_store_code.rs
│ │ └── msg_execute_contract.rs
│ ├── vesting
│ │ ├── period.rs
│ │ ├── delayed_vesting_account.rs
│ │ ├── permanent_locked_account.rs
│ │ ├── continuous_vesting_account.rs
│ │ ├── periodic_vesting_account.rs
│ │ └── base_vesting_account.rs
│ ├── auth
│ │ ├── module_account.rs
│ │ └── base_account.rs
│ ├── cosmwasm.rs
│ ├── lib.rs
│ ├── error.rs
│ ├── bank
│ │ ├── msg_send.rs
│ │ ├── msg_multi_send.rs
│ │ └── multi_send_io.rs
│ ├── feegrant
│ │ ├── msg_revoke_allowance.rs
│ │ ├── msg_grant_allowance.rs
│ │ ├── allowed_msg_allowance.rs
│ │ └── basic_allowance.rs
│ └── distribution
│ │ ├── msg_set_withdraw_address.rs
│ │ ├── msg_withdraw_validator_commission.rs
│ │ ├── msg_withdraw_delegator_reward.rs
│ │ └── msg_fund_community_pool.rs
├── Cargo.toml
└── README.md
├── Cargo.toml
├── .github
├── dependabot.yml
└── workflows
│ ├── proto-build.yml
│ ├── workspace.yml
│ ├── cosmos-sdk-proto.yml
│ └── cosmrs.yml
├── .gitmodules
├── proto-build
├── Cargo.toml
├── buf.sdk.gen.yaml
└── buf.wasmd.gen.yaml
└── .githooks
└── pre-commit
/.gitignore:
--------------------------------------------------------------------------------
1 | target/
2 |
--------------------------------------------------------------------------------
/rust-toolchain:
--------------------------------------------------------------------------------
1 | 1.75.0
2 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/wasmd/WASMD_COMMIT:
--------------------------------------------------------------------------------
1 | v0.52.0
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/COSMOS_SDK_COMMIT:
--------------------------------------------------------------------------------
1 | v0.50.9
--------------------------------------------------------------------------------
/.images/cosmos.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/cosmos/cosmos-rust/HEAD/.images/cosmos.png
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/wasmd/amino.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmrs/src/base/query.rs:
--------------------------------------------------------------------------------
1 | mod pagination;
2 |
3 | pub use pagination::{PageRequest, PageResponse};
4 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/amino.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/wasmd/cosmos.msg.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.msg.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/wasmd/cosmos.query.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.query.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.msg.textual.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | // @@protoc_insertion_point(module)
3 |
--------------------------------------------------------------------------------
/Cargo.toml:
--------------------------------------------------------------------------------
1 | [workspace]
2 | resolver = "2"
3 | members = [
4 | "proto-build",
5 | "cosmos-sdk-proto",
6 | "cosmrs"
7 | ]
8 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: cargo
4 | directory: "/"
5 | schedule:
6 | interval: weekly
7 | open-pull-requests-limit: 10
8 |
--------------------------------------------------------------------------------
/cosmrs/src/crypto/secp256k1.rs:
--------------------------------------------------------------------------------
1 | //! ECDSA/secp256k1 support
2 |
3 | mod signing_key;
4 |
5 | pub use self::signing_key::{EcdsaSigner, SigningKey};
6 | pub use k256::ecdsa::{Signature, VerifyingKey};
7 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "cosmos-sdk"]
2 | path = cosmos-sdk-go
3 | url = https://github.com/cosmos/cosmos-sdk.git
4 | [submodule "wasmd"]
5 | path = wasmd
6 | url = https://github.com/CosmWasm/wasmd.git
7 |
--------------------------------------------------------------------------------
/cosmrs/src/auth.rs:
--------------------------------------------------------------------------------
1 | //! Authentication module: AuthN-related functionality.
2 |
3 | mod base_account;
4 | mod module_account;
5 |
6 | pub use self::{base_account::BaseAccount, module_account::ModuleAccount};
7 |
--------------------------------------------------------------------------------
/cosmrs/src/bank.rs:
--------------------------------------------------------------------------------
1 | //! Bank module support
2 | //!
3 | //!
4 |
5 | mod msg_multi_send;
6 | mod msg_send;
7 | mod multi_send_io;
8 |
9 | pub use self::{msg_multi_send::MsgMultiSend, msg_send::MsgSend, multi_send_io::MultiSendIo};
10 |
--------------------------------------------------------------------------------
/cosmrs/src/crypto.rs:
--------------------------------------------------------------------------------
1 | //! Cryptographic functionality
2 |
3 | pub mod secp256k1;
4 |
5 | mod compact_bit_array;
6 | mod legacy_amino;
7 | mod public_key;
8 |
9 | pub use self::{
10 | compact_bit_array::CompactBitArray, legacy_amino::LegacyAminoMultisig, public_key::PublicKey,
11 | };
12 |
--------------------------------------------------------------------------------
/cosmrs/src/abci.rs:
--------------------------------------------------------------------------------
1 | //! Application/BlockChain Interface (ABCI)-related functionality.
2 |
3 | mod gas_info;
4 | mod msg_data;
5 |
6 | pub use self::{
7 | gas_info::GasInfo,
8 | msg_data::{MsgData, MsgResponse, TxMsgData},
9 | };
10 |
11 | /// Transaction data.
12 | pub type Data = Vec;
13 |
--------------------------------------------------------------------------------
/cosmrs/src/base.rs:
--------------------------------------------------------------------------------
1 | //! Base functionality.
2 |
3 | mod account_id;
4 | mod coin;
5 | mod denom;
6 |
7 | /// Query support
8 | pub mod query;
9 |
10 | pub use self::{account_id::AccountId, coin::Coin, denom::Denom};
11 |
12 | /// Amounts.
13 | pub type Amount = u128;
14 |
15 | /// Gas cost.
16 | pub type Gas = u64;
17 |
--------------------------------------------------------------------------------
/proto-build/Cargo.toml:
--------------------------------------------------------------------------------
1 | [package]
2 | name = "proto-build"
3 | version = "0.1.0"
4 | authors = ["Justin Kilpatrick ", "Tony Arcieri "]
5 | edition = "2018"
6 | publish = false
7 | rust-version = "1.75"
8 |
9 | [dependencies]
10 | prost = "0.13"
11 | prost-build = "0.13"
12 | tonic = "0.13"
13 | tonic-build = "0.13"
14 | regex = "1"
15 | walkdir = "2"
16 |
--------------------------------------------------------------------------------
/proto-build/buf.sdk.gen.yaml:
--------------------------------------------------------------------------------
1 | version: v1
2 | plugins:
3 | - plugin: buf.build/community/neoeinstein-prost:v0.3.1
4 | out: .
5 | opt:
6 | - compile_well_known_types
7 | - enable_type_names
8 | - extern_path=.google.protobuf=::tendermint_proto::google::protobuf
9 | - extern_path=.tendermint=::tendermint_proto
10 | - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0
11 | out: .
12 | - plugin: buf.build/community/neoeinstein-tonic:v0.3.0
13 | out: .
14 |
--------------------------------------------------------------------------------
/cosmrs/src/feegrant.rs:
--------------------------------------------------------------------------------
1 | //! Fee grant module support
2 | //!
3 | //!
4 |
5 | mod allowed_msg_allowance;
6 | mod basic_allowance;
7 | mod msg_grant_allowance;
8 | mod msg_revoke_allowance;
9 | mod periodic_allowance;
10 |
11 | pub use self::{
12 | allowed_msg_allowance::AllowedMsgAllowance, basic_allowance::BasicAllowance,
13 | msg_grant_allowance::MsgGrantAllowance, msg_revoke_allowance::MsgRevokeAllowance,
14 | periodic_allowance::PeriodicAllowance,
15 | };
16 |
--------------------------------------------------------------------------------
/.githooks/pre-commit:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | LC_ALL=C
3 |
4 | local_branch="$(git rev-parse --abbrev-ref HEAD)"
5 |
6 | valid_branch_regex="[a-z0-9._-]+\/[a-z0-9._-]+$"
7 |
8 | message="There is something wrong with your branch name. Branch names in this project must adhere to the format username/branch-name. Your commit will be rejected. You should rename your branch to a valid name and try again."
9 |
10 | if [[ ! $local_branch =~ $valid_branch_regex ]]
11 | then
12 | echo "$message"
13 | exit 1
14 | fi
15 |
16 | exit 0
17 |
--------------------------------------------------------------------------------
/proto-build/buf.wasmd.gen.yaml:
--------------------------------------------------------------------------------
1 | version: v1
2 | plugins:
3 | - plugin: buf.build/community/neoeinstein-prost:v0.3.1
4 | out: .
5 | opt:
6 | - compile_well_known_types
7 | - enable_type_names
8 | - extern_path=.google.protobuf=::tendermint_proto::google::protobuf
9 | - extern_path=.tendermint=::tendermint_proto::v0_34
10 | - plugin: buf.build/community/neoeinstein-prost-serde:v0.3.0
11 | out: .
12 | - plugin: buf.build/community/neoeinstein-tonic:v0.3.0
13 | out: .
14 | opt:
15 | - no_server=true
16 |
--------------------------------------------------------------------------------
/cosmrs/src/vesting.rs:
--------------------------------------------------------------------------------
1 | //! Vesting-related types
2 |
3 | mod base_vesting_account;
4 | mod continuous_vesting_account;
5 | mod delayed_vesting_account;
6 | mod period;
7 | mod periodic_vesting_account;
8 | mod permanent_locked_account;
9 |
10 | pub use self::{
11 | base_vesting_account::BaseVestingAccount, continuous_vesting_account::ContinuousVestingAccount,
12 | delayed_vesting_account::DelayedVestingAccount, period::Period,
13 | periodic_vesting_account::PeriodicVestingAccount,
14 | permanent_locked_account::PermanentLockedAccount,
15 | };
16 |
--------------------------------------------------------------------------------
/cosmrs/src/distribution.rs:
--------------------------------------------------------------------------------
1 | //! Distribution module support
2 | //!
3 | //!
4 |
5 | mod msg_fund_community_pool;
6 | mod msg_set_withdraw_address;
7 | mod msg_withdraw_delegator_reward;
8 | mod msg_withdraw_validator_commission;
9 |
10 | pub use self::{
11 | msg_fund_community_pool::MsgFundCommunityPool, msg_set_withdraw_address::MsgSetWithdrawAddress,
12 | msg_withdraw_delegator_reward::MsgWithdrawDelegatorReward,
13 | msg_withdraw_validator_commission::MsgWithdrawValidatorCommission,
14 | };
15 |
--------------------------------------------------------------------------------
/.github/workflows/proto-build.yml:
--------------------------------------------------------------------------------
1 | name: proto-build
2 |
3 | on:
4 | push:
5 | branches: main
6 | pull_request:
7 | paths:
8 | - ".github/workflows/proto-build.yml"
9 | - "proto-build/**"
10 | - "Cargo.*"
11 |
12 | defaults:
13 | run:
14 | working-directory: proto-build
15 |
16 | env:
17 | CARGO_TERM_COLOR: always
18 | RUSTFLAGS: -Dwarnings
19 |
20 | jobs:
21 | build:
22 | runs-on: ubuntu-latest
23 | steps:
24 | - uses: actions/checkout@v2
25 | - run: cargo build --verbose
26 | - run: cargo test --verbose
27 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.nft.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the nft module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.nft.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.nft.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.nft.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.authz.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the authz module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.authz.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.authz.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.authz.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.params.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the params module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.params.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.params.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.params.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object for the genutil module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.genutil.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.genutil.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.genutil.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.vesting.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the vesting module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.vesting.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.vesting.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.vesting.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.evidence.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the evidence module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.evidence.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.evidence.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.evidence.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.feegrant.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the feegrant module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {}
6 | impl ::prost::Name for Module {
7 | const NAME: &'static str = "Module";
8 | const PACKAGE: &'static str = "cosmos.feegrant.module.v1";
9 | fn full_name() -> ::prost::alloc::string::String {
10 | ::prost::alloc::format!("cosmos.feegrant.module.v1.{}", Self::NAME)
11 | }
12 | }
13 | include!("cosmos.feegrant.module.v1.serde.rs");
14 | // @@protoc_insertion_point(module)
15 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing/query_params_request.rs:
--------------------------------------------------------------------------------
1 | use crate::proto;
2 |
3 | /// QueryParamsRequest is the request type for the Query/Params RPC method
4 | #[derive(Clone, Copy, Debug, Eq, PartialEq)]
5 | pub struct QueryParamsRequest {}
6 |
7 | impl From for QueryParamsRequest {
8 | fn from(_proto: cosmos_sdk_proto::cosmos::slashing::v1beta1::QueryParamsRequest) -> Self {
9 | QueryParamsRequest {}
10 | }
11 | }
12 | impl From for proto::cosmos::slashing::v1beta1::QueryParamsRequest {
13 | fn from(_request: QueryParamsRequest) -> Self {
14 | cosmos_sdk_proto::cosmos::slashing::v1beta1::QueryParamsRequest {}
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.orm.module.v1alpha1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module defines the ORM module which adds providers to the app container for
3 | /// ORM ModuleDB's and in the future will automatically register query
4 | /// services for modules that use the ORM.
5 | #[allow(clippy::derive_partial_eq_without_eq)]
6 | #[derive(Clone, PartialEq, ::prost::Message)]
7 | pub struct Module {}
8 | impl ::prost::Name for Module {
9 | const NAME: &'static str = "Module";
10 | const PACKAGE: &'static str = "cosmos.orm.module.v1alpha1";
11 | fn full_name() -> ::prost::alloc::string::String {
12 | ::prost::alloc::format!("cosmos.orm.module.v1alpha1.{}", Self::NAME)
13 | }
14 | }
15 | include!("cosmos.orm.module.v1alpha1.serde.rs");
16 | // @@protoc_insertion_point(module)
17 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.circuit.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the circuit module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// authority defines the custom module authority. If not set, defaults to the governance module.
7 | #[prost(string, tag = "1")]
8 | pub authority: ::prost::alloc::string::String,
9 | }
10 | impl ::prost::Name for Module {
11 | const NAME: &'static str = "Module";
12 | const PACKAGE: &'static str = "cosmos.circuit.module.v1";
13 | fn full_name() -> ::prost::alloc::string::String {
14 | ::prost::alloc::format!("cosmos.circuit.module.v1.{}", Self::NAME)
15 | }
16 | }
17 | include!("cosmos.circuit.module.v1.serde.rs");
18 | // @@protoc_insertion_point(module)
19 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.upgrade.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the upgrade module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// authority defines the custom module authority. If not set, defaults to the governance module.
7 | #[prost(string, tag = "1")]
8 | pub authority: ::prost::alloc::string::String,
9 | }
10 | impl ::prost::Name for Module {
11 | const NAME: &'static str = "Module";
12 | const PACKAGE: &'static str = "cosmos.upgrade.module.v1";
13 | fn full_name() -> ::prost::alloc::string::String {
14 | ::prost::alloc::format!("cosmos.upgrade.module.v1.{}", Self::NAME)
15 | }
16 | }
17 | include!("cosmos.upgrade.module.v1.serde.rs");
18 | // @@protoc_insertion_point(module)
19 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.genutil.v1beta1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// GenesisState defines the raw genesis transaction in JSON.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct GenesisState {
6 | /// gen_txs defines the genesis transactions.
7 | #[prost(bytes = "vec", repeated, tag = "1")]
8 | pub gen_txs: ::prost::alloc::vec::Vec<::prost::alloc::vec::Vec>,
9 | }
10 | impl ::prost::Name for GenesisState {
11 | const NAME: &'static str = "GenesisState";
12 | const PACKAGE: &'static str = "cosmos.genutil.v1beta1";
13 | fn full_name() -> ::prost::alloc::string::String {
14 | ::prost::alloc::format!("cosmos.genutil.v1beta1.{}", Self::NAME)
15 | }
16 | }
17 | include!("cosmos.genutil.v1beta1.serde.rs");
18 | // @@protoc_insertion_point(module)
19 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.slashing.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the slashing module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// authority defines the custom module authority. If not set, defaults to the governance module.
7 | #[prost(string, tag = "1")]
8 | pub authority: ::prost::alloc::string::String,
9 | }
10 | impl ::prost::Name for Module {
11 | const NAME: &'static str = "Module";
12 | const PACKAGE: &'static str = "cosmos.slashing.module.v1";
13 | fn full_name() -> ::prost::alloc::string::String {
14 | ::prost::alloc::format!("cosmos.slashing.module.v1.{}", Self::NAME)
15 | }
16 | }
17 | include!("cosmos.slashing.module.v1.serde.rs");
18 | // @@protoc_insertion_point(module)
19 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.consensus.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the consensus module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// authority defines the custom module authority. If not set, defaults to the governance module.
7 | #[prost(string, tag = "1")]
8 | pub authority: ::prost::alloc::string::String,
9 | }
10 | impl ::prost::Name for Module {
11 | const NAME: &'static str = "Module";
12 | const PACKAGE: &'static str = "cosmos.consensus.module.v1";
13 | fn full_name() -> ::prost::alloc::string::String {
14 | ::prost::alloc::format!("cosmos.consensus.module.v1.{}", Self::NAME)
15 | }
16 | }
17 | include!("cosmos.consensus.module.v1.serde.rs");
18 | // @@protoc_insertion_point(module)
19 |
--------------------------------------------------------------------------------
/.github/workflows/workspace.yml:
--------------------------------------------------------------------------------
1 | name: Workspace
2 |
3 | on:
4 | push:
5 | branches: main
6 | paths-ignore:
7 | - README.md
8 | pull_request:
9 | paths-ignore:
10 | - README.md
11 |
12 | env:
13 | CARGO_TERM_COLOR: always
14 | RUSTFLAGS: -Dwarnings
15 |
16 | jobs:
17 | rustfmt:
18 | runs-on: ubuntu-latest
19 | steps:
20 | - uses: actions/checkout@v2
21 | - uses: dtolnay/rust-toolchain@master
22 | with:
23 | toolchain: 1.75.0
24 | components: rustfmt
25 | - run: cargo fmt --all -- --check
26 |
27 | clippy:
28 | runs-on: ubuntu-latest
29 | steps:
30 | - uses: actions/checkout@v2
31 | - uses: dtolnay/rust-toolchain@master
32 | with:
33 | toolchain: 1.75.0
34 | components: clippy
35 | - run: cargo clippy --all --all-features -- -D warnings
36 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.mint.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the mint module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | #[prost(string, tag = "1")]
7 | pub fee_collector_name: ::prost::alloc::string::String,
8 | /// authority defines the custom module authority. If not set, defaults to the governance module.
9 | #[prost(string, tag = "2")]
10 | pub authority: ::prost::alloc::string::String,
11 | }
12 | impl ::prost::Name for Module {
13 | const NAME: &'static str = "Module";
14 | const PACKAGE: &'static str = "cosmos.mint.module.v1";
15 | fn full_name() -> ::prost::alloc::string::String {
16 | ::prost::alloc::format!("cosmos.mint.module.v1.{}", Self::NAME)
17 | }
18 | }
19 | include!("cosmos.mint.module.v1.serde.rs");
20 | // @@protoc_insertion_point(module)
21 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.distribution.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the distribution module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | #[prost(string, tag = "1")]
7 | pub fee_collector_name: ::prost::alloc::string::String,
8 | /// authority defines the custom module authority. If not set, defaults to the governance module.
9 | #[prost(string, tag = "2")]
10 | pub authority: ::prost::alloc::string::String,
11 | }
12 | impl ::prost::Name for Module {
13 | const NAME: &'static str = "Module";
14 | const PACKAGE: &'static str = "cosmos.distribution.module.v1";
15 | fn full_name() -> ::prost::alloc::string::String {
16 | ::prost::alloc::format!("cosmos.distribution.module.v1.{}", Self::NAME)
17 | }
18 | }
19 | include!("cosmos.distribution.module.v1.serde.rs");
20 | // @@protoc_insertion_point(module)
21 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crypto.multisig.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// LegacyAminoPubKey specifies a public key type
3 | /// which nests multiple public keys and a threshold,
4 | /// it uses legacy amino address rules.
5 | #[allow(clippy::derive_partial_eq_without_eq)]
6 | #[derive(Clone, PartialEq, ::prost::Message)]
7 | pub struct LegacyAminoPubKey {
8 | #[prost(uint32, tag = "1")]
9 | pub threshold: u32,
10 | #[prost(message, repeated, tag = "2")]
11 | pub public_keys: ::prost::alloc::vec::Vec<::tendermint_proto::google::protobuf::Any>,
12 | }
13 | impl ::prost::Name for LegacyAminoPubKey {
14 | const NAME: &'static str = "LegacyAminoPubKey";
15 | const PACKAGE: &'static str = "cosmos.crypto.multisig";
16 | fn full_name() -> ::prost::alloc::string::String {
17 | ::prost::alloc::format!("cosmos.crypto.multisig.{}", Self::NAME)
18 | }
19 | }
20 | include!("cosmos.crypto.multisig.serde.rs");
21 | // @@protoc_insertion_point(module)
22 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing/missed_block.rs:
--------------------------------------------------------------------------------
1 | use crate::proto;
2 |
3 | /// MissedBlock contains height and missed status as boolean.
4 | #[derive(Clone, Copy, Debug, Eq, PartialEq)]
5 | pub struct MissedBlock {
6 | /// index is the height at which the block was missed.
7 | pub index: i64,
8 |
9 | /// missed is the missed status.
10 | pub missed: bool,
11 | }
12 |
13 | impl From for MissedBlock {
14 | fn from(proto: cosmos_sdk_proto::cosmos::slashing::v1beta1::MissedBlock) -> MissedBlock {
15 | MissedBlock {
16 | index: proto.index,
17 | missed: proto.missed,
18 | }
19 | }
20 | }
21 |
22 | impl From for cosmos_sdk_proto::cosmos::slashing::v1beta1::MissedBlock {
23 | fn from(missed_block: MissedBlock) -> Self {
24 | cosmos_sdk_proto::cosmos::slashing::v1beta1::MissedBlock {
25 | index: missed_block.index,
26 | missed: missed_block.missed,
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.crisis.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the crisis module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// fee_collector_name is the name of the FeeCollector ModuleAccount.
7 | #[prost(string, tag = "1")]
8 | pub fee_collector_name: ::prost::alloc::string::String,
9 | /// authority defines the custom module authority. If not set, defaults to the governance module.
10 | #[prost(string, tag = "2")]
11 | pub authority: ::prost::alloc::string::String,
12 | }
13 | impl ::prost::Name for Module {
14 | const NAME: &'static str = "Module";
15 | const PACKAGE: &'static str = "cosmos.crisis.module.v1";
16 | fn full_name() -> ::prost::alloc::string::String {
17 | ::prost::alloc::format!("cosmos.crisis.module.v1.{}", Self::NAME)
18 | }
19 | }
20 | include!("cosmos.crisis.module.v1.serde.rs");
21 | // @@protoc_insertion_point(module)
22 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.gov.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the gov module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// max_metadata_len defines the maximum proposal metadata length.
7 | /// Defaults to 255 if not explicitly set.
8 | #[prost(uint64, tag = "1")]
9 | pub max_metadata_len: u64,
10 | /// authority defines the custom module authority. If not set, defaults to the governance module.
11 | #[prost(string, tag = "2")]
12 | pub authority: ::prost::alloc::string::String,
13 | }
14 | impl ::prost::Name for Module {
15 | const NAME: &'static str = "Module";
16 | const PACKAGE: &'static str = "cosmos.gov.module.v1";
17 | fn full_name() -> ::prost::alloc::string::String {
18 | ::prost::alloc::format!("cosmos.gov.module.v1.{}", Self::NAME)
19 | }
20 | }
21 | include!("cosmos.gov.module.v1.serde.rs");
22 | // @@protoc_insertion_point(module)
23 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.tx.config.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Config is the config object of the x/auth/tx package.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Config {
6 | /// skip_ante_handler defines whether the ante handler registration should be skipped in case an app wants to override
7 | /// this functionality.
8 | #[prost(bool, tag = "1")]
9 | pub skip_ante_handler: bool,
10 | /// skip_post_handler defines whether the post handler registration should be skipped in case an app wants to override
11 | /// this functionality.
12 | #[prost(bool, tag = "2")]
13 | pub skip_post_handler: bool,
14 | }
15 | impl ::prost::Name for Config {
16 | const NAME: &'static str = "Config";
17 | const PACKAGE: &'static str = "cosmos.tx.config.v1";
18 | fn full_name() -> ::prost::alloc::string::String {
19 | ::prost::alloc::format!("cosmos.tx.config.v1.{}", Self::NAME)
20 | }
21 | }
22 | include!("cosmos.tx.config.v1.serde.rs");
23 | // @@protoc_insertion_point(module)
24 |
--------------------------------------------------------------------------------
/cosmrs/src/staking/query_historical_info_request.rs:
--------------------------------------------------------------------------------
1 | use crate::proto;
2 |
3 | /// QueryHistoricalInfoRequest is request type for the Query/HistoricalInfo RPC
4 | /// method.
5 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
6 | pub struct QueryHistoricalInfoRequest {
7 | /// height defines at which height to query the historical info.
8 | pub height: i64,
9 | }
10 |
11 | impl From
12 | for QueryHistoricalInfoRequest
13 | {
14 | fn from(proto: cosmos_sdk_proto::cosmos::staking::v1beta1::QueryHistoricalInfoRequest) -> Self {
15 | QueryHistoricalInfoRequest {
16 | height: proto.height,
17 | }
18 | }
19 | }
20 |
21 | impl From
22 | for proto::cosmos::staking::v1beta1::QueryHistoricalInfoRequest
23 | {
24 | fn from(query_historical_info_request: QueryHistoricalInfoRequest) -> Self {
25 | proto::cosmos::staking::v1beta1::QueryHistoricalInfoRequest {
26 | height: query_historical_info_request.height,
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing/query_signing_infos_request.rs:
--------------------------------------------------------------------------------
1 | use crate::base::query::PageRequest;
2 | use crate::proto;
3 |
4 | /// QuerySigningInfosRequest is the request type for the Query/SigningInfos RPC
5 | /// method
6 | #[derive(Clone, Debug, Eq, PartialEq)]
7 | pub struct QuerySigningInfosRequest {
8 | /// Pagination control of the request
9 | pub pagination: Option,
10 | }
11 |
12 | impl From for QuerySigningInfosRequest {
13 | fn from(proto: cosmos_sdk_proto::cosmos::slashing::v1beta1::QuerySigningInfosRequest) -> Self {
14 | QuerySigningInfosRequest {
15 | pagination: proto.pagination.map(Into::into),
16 | }
17 | }
18 | }
19 |
20 | impl From for proto::cosmos::slashing::v1beta1::QuerySigningInfosRequest {
21 | fn from(signing_infos_request: QuerySigningInfosRequest) -> Self {
22 | proto::cosmos::slashing::v1beta1::QuerySigningInfosRequest {
23 | pagination: signing_infos_request.pagination.map(Into::into),
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing/query_params_response.rs:
--------------------------------------------------------------------------------
1 | use crate::slashing::Params;
2 | use crate::{proto, ErrorReport, Result};
3 |
4 | /// QueryParamsResponse is the response type for the Query/Params RPC method
5 | #[derive(Clone, Debug, Eq, PartialEq)]
6 | pub struct QueryParamsResponse {
7 | /// Parameters of the slashing module
8 | pub params: Option,
9 | }
10 |
11 | impl TryFrom for QueryParamsResponse {
12 | type Error = ErrorReport;
13 |
14 | fn try_from(
15 | proto: cosmos_sdk_proto::cosmos::slashing::v1beta1::QueryParamsResponse,
16 | ) -> Result {
17 | Ok(QueryParamsResponse {
18 | params: proto.params.map(TryInto::try_into).transpose()?,
19 | })
20 | }
21 | }
22 |
23 | impl From for proto::cosmos::slashing::v1beta1::QueryParamsResponse {
24 | fn from(params_response: QueryParamsResponse) -> Self {
25 | proto::cosmos::slashing::v1beta1::QueryParamsResponse {
26 | params: params_response.params.map(Into::into),
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/cosmrs/src/tx/msg.rs:
--------------------------------------------------------------------------------
1 | //! Transaction messages
2 |
3 | use crate::{
4 | proto::traits::{MessageExt, Name},
5 | Any, ErrorReport, Result,
6 | };
7 |
8 | /// Message types.
9 | ///
10 | /// Types which impl this trait map one-to-one with a corresponding Protocol
11 | /// Buffers type, but can assert additional invariants and/or additional
12 | /// functionality beyond the raw proto, as well as providing a more idiomatic
13 | /// Rust type to work with.
14 | pub trait Msg:
15 | Clone + Sized + TryFrom + Into
16 | {
17 | /// Protocol Buffers type
18 | type Proto: Default + MessageExt + Name + Sized;
19 |
20 | /// Parse this message proto from [`Any`].
21 | fn from_any(any: &Any) -> Result {
22 | any.to_msg::()?.try_into()
23 | }
24 |
25 | /// Serialize this message proto as [`Any`].
26 | fn to_any(&self) -> Result {
27 | self.clone().into_any()
28 | }
29 |
30 | /// Convert this message proto into [`Any`].
31 | fn into_any(self) -> Result {
32 | Ok(Any::from_msg(&self.into())?)
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/cosmrs/src/staking/query_validator_request.rs:
--------------------------------------------------------------------------------
1 | use crate::{proto, AccountId, ErrorReport, Result};
2 |
3 | /// QueryValidatorRequest is response type for the Query/Validator RPC method
4 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
5 | pub struct QueryValidatorRequest {
6 | /// validator_addr defines the validator address to query for.
7 | pub validator_addr: AccountId,
8 | }
9 |
10 | impl TryFrom for QueryValidatorRequest {
11 | type Error = ErrorReport;
12 |
13 | fn try_from(
14 | proto: cosmos_sdk_proto::cosmos::staking::v1beta1::QueryValidatorRequest,
15 | ) -> Result {
16 | Ok(QueryValidatorRequest {
17 | validator_addr: proto.validator_addr.parse()?,
18 | })
19 | }
20 | }
21 |
22 | impl From for proto::cosmos::staking::v1beta1::QueryValidatorRequest {
23 | fn from(query_validator_request: QueryValidatorRequest) -> Self {
24 | proto::cosmos::staking::v1beta1::QueryValidatorRequest {
25 | validator_addr: query_validator_request.validator_addr.to_string(),
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/cosmrs/src/staking/query_validator_response.rs:
--------------------------------------------------------------------------------
1 | use crate::staking::Validator;
2 | use crate::{proto, ErrorReport, Result};
3 |
4 | /// QueryValidatorResponse is response type for the Query/Validator RPC method
5 | #[derive(Clone, Debug, PartialEq)]
6 | pub struct QueryValidatorResponse {
7 | /// validator defines the validator info.
8 | pub validator: Option,
9 | }
10 |
11 | impl TryFrom for QueryValidatorResponse {
12 | type Error = ErrorReport;
13 |
14 | fn try_from(
15 | proto: cosmos_sdk_proto::cosmos::staking::v1beta1::QueryValidatorResponse,
16 | ) -> Result {
17 | Ok(QueryValidatorResponse {
18 | validator: proto.validator.map(TryInto::try_into).transpose()?,
19 | })
20 | }
21 | }
22 |
23 | impl From for proto::cosmos::staking::v1beta1::QueryValidatorResponse {
24 | fn from(query_validator_response: QueryValidatorResponse) -> Self {
25 | proto::cosmos::staking::v1beta1::QueryValidatorResponse {
26 | validator: query_validator_response.validator.map(Into::into),
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/cosmrs/src/abci/gas_info.rs:
--------------------------------------------------------------------------------
1 | use crate::{proto, ErrorReport, Gas, Result};
2 | use serde::{Deserialize, Serialize};
3 |
4 | /// [`GasInfo`] defines constraints for how much gas to use to execute a
5 | /// transaction.
6 | #[derive(Copy, Clone, Debug, Serialize, Deserialize, Default, Eq, PartialEq)]
7 | pub struct GasInfo {
8 | /// GasWanted is the maximum units of work we allow this tx to perform.
9 | pub gas_wanted: Gas,
10 |
11 | /// GasUsed is the amount of gas actually consumed.
12 | pub gas_used: Gas,
13 | }
14 |
15 | impl TryFrom for GasInfo {
16 | type Error = ErrorReport;
17 |
18 | fn try_from(proto: proto::cosmos::base::abci::v1beta1::GasInfo) -> Result {
19 | Ok(GasInfo {
20 | gas_wanted: proto.gas_wanted,
21 | gas_used: proto.gas_used,
22 | })
23 | }
24 | }
25 |
26 | impl From for proto::cosmos::base::abci::v1beta1::GasInfo {
27 | fn from(info: GasInfo) -> Self {
28 | proto::cosmos::base::abci::v1beta1::GasInfo {
29 | gas_wanted: info.gas_wanted,
30 | gas_used: info.gas_wanted,
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing.rs:
--------------------------------------------------------------------------------
1 | //! Slashing module support
2 | //!
3 | //!
4 |
5 | mod genesis_state;
6 | mod missed_block;
7 | mod msg_unjail;
8 | mod params;
9 | mod query_params_request;
10 | mod query_params_response;
11 | mod query_signing_info_request;
12 | mod query_signing_info_response;
13 | mod query_signing_infos_request;
14 | mod query_signing_infos_response;
15 | mod signing_info;
16 | mod validator_missed_blocks;
17 | mod validator_signing_info;
18 |
19 | pub use self::{
20 | genesis_state::GenesisState,
21 | missed_block::MissedBlock,
22 | msg_unjail::{MsgUnjail, MsgUnjailResponse},
23 | params::Params,
24 | query_params_request::QueryParamsRequest,
25 | query_params_response::QueryParamsResponse,
26 | query_signing_info_request::QuerySigningInfoRequest,
27 | query_signing_info_response::QuerySigningInfoResponse,
28 | query_signing_infos_request::QuerySigningInfosRequest,
29 | query_signing_infos_response::QuerySigningInfosResponse,
30 | signing_info::SigningInfo,
31 | validator_missed_blocks::ValidatorMissedBlocks,
32 | validator_signing_info::ValidatorSigningInfo,
33 | };
34 |
--------------------------------------------------------------------------------
/cosmrs/src/staking.rs:
--------------------------------------------------------------------------------
1 | //! Staking module support
2 | //!
3 | //!
4 |
5 | mod commission;
6 | mod commission_rates;
7 | mod description;
8 | mod historical_info;
9 | mod msg_begin_redelegate;
10 | mod msg_delegate;
11 | mod msg_undelegate;
12 | mod query_historical_info_request;
13 | mod query_historical_info_response;
14 | mod query_validator_request;
15 | mod query_validator_response;
16 | mod query_validators_request;
17 | mod query_validators_response;
18 | mod validator;
19 |
20 | pub use self::{
21 | commission::Commission, commission_rates::CommissionRates, description::Description,
22 | historical_info::HistoricalInfo, msg_begin_redelegate::MsgBeginRedelegate,
23 | msg_delegate::MsgDelegate, msg_undelegate::MsgUndelegate,
24 | query_historical_info_request::QueryHistoricalInfoRequest,
25 | query_historical_info_response::QueryHistoricalInfoResponse,
26 | query_validator_request::QueryValidatorRequest,
27 | query_validator_response::QueryValidatorResponse,
28 | query_validators_request::QueryValidatorsRequest,
29 | query_validators_response::QueryValidatorsResponse, validator::Validator,
30 | };
31 |
--------------------------------------------------------------------------------
/cosmrs/src/slashing/query_signing_info_request.rs:
--------------------------------------------------------------------------------
1 | use crate::{proto, AccountId, ErrorReport, Result};
2 |
3 | /// QuerySigningInfoRequest is the request type for the Query/SigningInfo RPC
4 | /// method
5 | #[derive(Clone, Debug, Eq, PartialEq)]
6 | pub struct QuerySigningInfoRequest {
7 | /// cons_address is the address to query signing info of
8 | pub cons_address: AccountId,
9 | }
10 |
11 | impl TryFrom
12 | for QuerySigningInfoRequest
13 | {
14 | type Error = ErrorReport;
15 |
16 | fn try_from(
17 | proto: cosmos_sdk_proto::cosmos::slashing::v1beta1::QuerySigningInfoRequest,
18 | ) -> Result {
19 | Ok(QuerySigningInfoRequest {
20 | cons_address: proto.cons_address.parse()?,
21 | })
22 | }
23 | }
24 |
25 | impl From for proto::cosmos::slashing::v1beta1::QuerySigningInfoRequest {
26 | fn from(signing_info_response: QuerySigningInfoRequest) -> Self {
27 | proto::cosmos::slashing::v1beta1::QuerySigningInfoRequest {
28 | cons_address: signing_info_response.cons_address.to_string(),
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/prost/cosmos-sdk/cosmos.group.module.v1.rs:
--------------------------------------------------------------------------------
1 | // @generated
2 | /// Module is the config object of the group module.
3 | #[allow(clippy::derive_partial_eq_without_eq)]
4 | #[derive(Clone, PartialEq, ::prost::Message)]
5 | pub struct Module {
6 | /// max_execution_period defines the max duration after a proposal's voting period ends that members can send a MsgExec
7 | /// to execute the proposal.
8 | #[prost(message, optional, tag = "1")]
9 | pub max_execution_period:
10 | ::core::option::Option<::tendermint_proto::google::protobuf::Duration>,
11 | /// max_metadata_len defines the max length of the metadata bytes field for various entities within the group module.
12 | /// Defaults to 255 if not explicitly set.
13 | #[prost(uint64, tag = "2")]
14 | pub max_metadata_len: u64,
15 | }
16 | impl ::prost::Name for Module {
17 | const NAME: &'static str = "Module";
18 | const PACKAGE: &'static str = "cosmos.group.module.v1";
19 | fn full_name() -> ::prost::alloc::string::String {
20 | ::prost::alloc::format!("cosmos.group.module.v1.{}", Self::NAME)
21 | }
22 | }
23 | include!("cosmos.group.module.v1.serde.rs");
24 | // @@protoc_insertion_point(module)
25 |
--------------------------------------------------------------------------------
/cosmrs/src/cosmwasm/query_code_response.rs:
--------------------------------------------------------------------------------
1 | use super::CodeInfoResponse;
2 | use crate::{proto, ErrorReport, Result};
3 |
4 | /// QueryCodeResponse is the response type for the Query/Code RPC method.
5 | #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)]
6 | pub struct QueryCodeResponse {
7 | /// If available, the associated code ID metadata.
8 | pub code_info: Option,
9 |
10 | /// The original wasm bytes.
11 | pub data: Vec,
12 | }
13 |
14 | impl TryFrom for QueryCodeResponse {
15 | type Error = ErrorReport;
16 |
17 | fn try_from(proto: proto::cosmwasm::wasm::v1::QueryCodeResponse) -> Result {
18 | Ok(QueryCodeResponse {
19 | code_info: proto.code_info.map(TryFrom::try_from).transpose()?,
20 | data: proto.data,
21 | })
22 | }
23 | }
24 |
25 | impl From for proto::cosmwasm::wasm::v1::QueryCodeResponse {
26 | fn from(response: QueryCodeResponse) -> Self {
27 | proto::cosmwasm::wasm::v1::QueryCodeResponse {
28 | code_info: response.code_info.map(Into::into),
29 | data: response.data,
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/cosmos-sdk-proto/src/traits.rs:
--------------------------------------------------------------------------------
1 | //! Support traits for Cosmos SDK protobufs.
2 |
3 | pub use prost::{Message, Name};
4 |
5 | use alloc::{string::String, vec::Vec};
6 | use core::str::FromStr;
7 | use prost::EncodeError;
8 |
9 | /// Extension trait for [`Message`].
10 | pub trait MessageExt: Message {
11 | /// Serialize this protobuf message as a byte vector.
12 | fn to_bytes(&self) -> Result, EncodeError>;
13 | }
14 |
15 | impl MessageExt for M
16 | where
17 | M: prost::Message,
18 | {
19 | fn to_bytes(&self) -> Result, EncodeError> {
20 | let mut bytes = Vec::new();
21 | Message::encode(self, &mut bytes)?;
22 | Ok(bytes)
23 | }
24 | }
25 |
26 | /// Extension traits for optionally parsing non-empty strings.
27 | ///
28 | /// This is a common pattern in Cosmos SDK protobufs.
29 | pub trait ParseOptional: AsRef {
30 | /// Parse optional field.
31 | fn parse_optional(&self) -> Result